Skip to content

Commit

Permalink
Report lines starting with &&.
Browse files Browse the repository at this point in the history
  • Loading branch information
zwn committed Apr 22, 2016
1 parent 924d804 commit 39780ca
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions python/tidy/servo_tidy/tidy.py
Expand Up @@ -378,6 +378,7 @@ def check_rust(file_name, lines):
(r": &Vec<", "use &[T] instead of &Vec<T>", 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:
Expand Down
5 changes: 4 additions & 1 deletion python/tidy/servo_tidy_tests/rust_tidy.rs
Expand Up @@ -32,6 +32,9 @@ impl test {
}

fn test_fun2(y : &String, z : &Vec<f32>) -> f32 {
1
let x = true;
x
&& x;
}

}
1 change: 1 addition & 0 deletions python/tidy/servo_tidy_tests/test_tidy.py
Expand Up @@ -70,6 +70,7 @@ def test_rust(self):
self.assertEqual('extra space before :', errors.next()[2])
self.assertEqual('use &[T] instead of &Vec<T>', 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):
Expand Down

0 comments on commit 39780ca

Please sign in to comment.