From a17ae724144af9bf997a7ad5de8d1fd72e5b7fdd Mon Sep 17 00:00:00 2001 From: mrmiywj Date: Sun, 15 May 2016 18:19:49 +0800 Subject: [PATCH] add &Root checker update rust_tidy tests update rust_tidy.rs and test_tidy.py --- python/tidy/servo_tidy/tidy.py | 2 ++ python/tidy/servo_tidy_tests/rust_tidy.rs | 2 +- python/tidy/servo_tidy_tests/test_tidy.py | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py index 1007fcb0440..6e559e15dab 100644 --- a/python/tidy/servo_tidy/tidy.py +++ b/python/tidy/servo_tidy/tidy.py @@ -387,6 +387,8 @@ def check_rust(file_name, lines): (r": &Vec<", "use &[T] instead of &Vec", no_filter), # No benefit over using &str (r": &String", "use &str instead of &String", no_filter), + # No benefit to using &Root + (r": &Root<", "use &T instead of &Root", no_filter), (r"^&&", "operators should go at the end of the first line", no_filter), ] diff --git a/python/tidy/servo_tidy_tests/rust_tidy.rs b/python/tidy/servo_tidy_tests/rust_tidy.rs index 92db863dfaa..aac81515319 100644 --- a/python/tidy/servo_tidy_tests/rust_tidy.rs +++ b/python/tidy/servo_tidy_tests/rust_tidy.rs @@ -35,7 +35,7 @@ impl test { } } - fn test_fun2(y : &String, z : &Vec) -> f32 { + fn test_fun2(y : &String, z : &Vec, r: &Root) -> f32 { let x = true; x && x; diff --git a/python/tidy/servo_tidy_tests/test_tidy.py b/python/tidy/servo_tidy_tests/test_tidy.py index 55dbb4ce21a..5aa381bec88 100644 --- a/python/tidy/servo_tidy_tests/test_tidy.py +++ b/python/tidy/servo_tidy_tests/test_tidy.py @@ -72,6 +72,7 @@ class CheckTidiness(unittest.TestCase): self.assertEqual('extra space before :', errors.next()[2]) self.assertEqual('use &[T] instead of &Vec', errors.next()[2]) self.assertEqual('use &str instead of &String', errors.next()[2]) + self.assertEqual('use &T instead of &Root', errors.next()[2]) self.assertEqual('operators should go at the end of the first line', errors.next()[2]) self.assertNoMoreErrors(errors)