mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
added tidy check for -> ()
This commit is contained in:
parent
94c344a014
commit
b1faaa15dc
3 changed files with 4 additions and 1 deletions
|
@ -565,6 +565,8 @@ def check_rust(file_name, lines):
|
|||
# This particular pattern is not reentrant-safe in script_thread.rs
|
||||
(r"match self.documents.borrow", "use a separate variable for the match expression",
|
||||
lambda match, line: file_name.endswith('script_thread.rs')),
|
||||
# -> () is unnecessary
|
||||
(r"-> \(\)", "encountered function signature with -> ()", no_filter),
|
||||
]
|
||||
|
||||
for pattern, message, filter_func in regex_rules:
|
||||
|
|
|
@ -38,7 +38,7 @@ impl test {
|
|||
}
|
||||
}
|
||||
|
||||
fn test_fun2(y : &String, z : &Vec<f32>, r: &Root<isize>) -> f32 {
|
||||
fn test_fun2(y : &String, z : &Vec<f32>, r: &Root<isize>) -> () {
|
||||
let x = true;
|
||||
x
|
||||
&& x;
|
||||
|
|
|
@ -123,6 +123,7 @@ class CheckTidiness(unittest.TestCase):
|
|||
self.assertEqual('use &[T] instead of &Vec<T>', errors.next()[2])
|
||||
self.assertEqual('use &str instead of &String', errors.next()[2])
|
||||
self.assertEqual('use &T instead of &Root<T>', errors.next()[2])
|
||||
self.assertEqual('encountered function signature with -> ()', errors.next()[2])
|
||||
self.assertEqual('operators should go at the end of the first line', errors.next()[2])
|
||||
self.assertEqual('else braces should be on the same line', errors.next()[2])
|
||||
self.assertEqual('extra space after (', errors.next()[2])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue