Report lines starting with &&.

This commit is contained in:
Zbynek Winkler 2016-04-20 16:39:43 +02:00
parent 924d804583
commit 39780ca39f
3 changed files with 6 additions and 1 deletions

View file

@ -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:

View file

@ -32,6 +32,9 @@ impl test {
}
fn test_fun2(y : &String, z : &Vec<f32>) -> f32 {
1
let x = true;
x
&& x;
}
}

View file

@ -70,6 +70,7 @@ class CheckTidiness(unittest.TestCase):
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):