From 39780ca39f2beff6c0f8e55eab75022b27cd046e Mon Sep 17 00:00:00 2001 From: Zbynek Winkler Date: Wed, 20 Apr 2016 16:39:43 +0200 Subject: [PATCH] Report lines starting with &&. --- python/tidy/servo_tidy/tidy.py | 1 + python/tidy/servo_tidy_tests/rust_tidy.rs | 5 ++++- python/tidy/servo_tidy_tests/test_tidy.py | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py index 9ee99edcf9d..aca74956c6f 100644 --- a/python/tidy/servo_tidy/tidy.py +++ b/python/tidy/servo_tidy/tidy.py @@ -378,6 +378,7 @@ 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), + (r"^&&", "operators should go at the end of the first line", no_filter), ] for pattern, message, filter_func in regex_rules: diff --git a/python/tidy/servo_tidy_tests/rust_tidy.rs b/python/tidy/servo_tidy_tests/rust_tidy.rs index 680b527f679..580f9e2ea96 100644 --- a/python/tidy/servo_tidy_tests/rust_tidy.rs +++ b/python/tidy/servo_tidy_tests/rust_tidy.rs @@ -32,6 +32,9 @@ impl test { } fn test_fun2(y : &String, z : &Vec) -> f32 { - 1 + 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 69bb4ae4e46..f61c7961195 100644 --- a/python/tidy/servo_tidy_tests/test_tidy.py +++ b/python/tidy/servo_tidy_tests/test_tidy.py @@ -70,6 +70,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('operators should go at the end of the first line', errors.next()[2]) self.assertNoMoreErrors(errors) def test_spec_link(self):