mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Rust tidy: disallow assignment = in the beginning of line
This commit is contained in:
parent
6d4ccab2b7
commit
adcedd8314
3 changed files with 6 additions and 0 deletions
|
@ -520,6 +520,8 @@ def check_rust(file_name, lines):
|
||||||
lambda match, line: is_attribute),
|
lambda match, line: is_attribute),
|
||||||
(r"=[A-Za-z0-9\"]", "missing space after =",
|
(r"=[A-Za-z0-9\"]", "missing space after =",
|
||||||
lambda match, line: is_attribute),
|
lambda match, line: is_attribute),
|
||||||
|
(r"^=\s", "no = in the beginning of line",
|
||||||
|
lambda match, line: not is_comment),
|
||||||
# ignore scientific notation patterns like 1e-6
|
# ignore scientific notation patterns like 1e-6
|
||||||
(r"[A-DF-Za-df-z0-9]-", "missing space before -",
|
(r"[A-DF-Za-df-z0-9]-", "missing space before -",
|
||||||
lambda match, line: not is_attribute),
|
lambda match, line: not is_attribute),
|
||||||
|
|
|
@ -59,4 +59,7 @@ impl test {
|
||||||
|
|
||||||
// Should not be triggered
|
// Should not be triggered
|
||||||
macro_rules! test_macro ( ( $( $fun:ident = $flag:ident ; )* ) => ());
|
macro_rules! test_macro ( ( $( $fun:ident = $flag:ident ; )* ) => ());
|
||||||
|
|
||||||
|
let var
|
||||||
|
= "val";
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,6 +125,7 @@ class CheckTidiness(unittest.TestCase):
|
||||||
self.assertEqual('extra space after (', errors.next()[2])
|
self.assertEqual('extra space after (', errors.next()[2])
|
||||||
self.assertEqual('extra space after (', errors.next()[2])
|
self.assertEqual('extra space after (', errors.next()[2])
|
||||||
self.assertEqual('extra space after test_fun', errors.next()[2])
|
self.assertEqual('extra space after test_fun', errors.next()[2])
|
||||||
|
self.assertEqual('no = in the beginning of line', errors.next()[2])
|
||||||
self.assertNoMoreErrors(errors)
|
self.assertNoMoreErrors(errors)
|
||||||
|
|
||||||
feature_errors = tidy.collect_errors_for_files(iterFile('lib.rs'), [], [tidy.check_rust], print_text=False)
|
feature_errors = tidy.collect_errors_for_files(iterFile('lib.rs'), [], [tidy.check_rust], print_text=False)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue