Add style check, test, and code fixes for an else brace check.

This commit is contained in:
Travis Dean 2016-07-04 17:05:20 -04:00
parent 80cb0cf821
commit 6642358217
9 changed files with 26 additions and 20 deletions

View file

@ -415,6 +415,7 @@ def check_rust(file_name, lines):
(r"^&&", "operators should go at the end of the first line", no_filter),
(r"\{[A-Za-z0-9_]+\};", "use statement contains braces for single import",
lambda match, line: line.startswith('use ')),
(r"^\s*else {", "else braces should be on the same line", no_filter),
]
for pattern, message, filter_func in regex_rules:

View file

@ -41,6 +41,12 @@ impl test {
let x = true;
x
&& x;
if x {
;
}
else {
;
}
}
}

View file

@ -76,6 +76,7 @@ class CheckTidiness(unittest.TestCase):
self.assertEqual('use &str instead of &String', errors.next()[2])
self.assertEqual('use &T instead of &Root<T>', 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.assertNoMoreErrors(errors)
def test_spec_link(self):