mirror of
https://github.com/servo/servo.git
synced 2025-06-08 16:43:28 +00:00
Report use statements that use {} with only one entry
This commit is contained in:
parent
4dcb05ca4f
commit
40acd24e8f
55 changed files with 92 additions and 89 deletions
|
@ -390,6 +390,8 @@ def check_rust(file_name, lines):
|
|||
# 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),
|
||||
(r"\{[A-Za-z0-9_]+\};", "use statement contains braces for single import",
|
||||
lambda match, line: line.startswith('use ')),
|
||||
]
|
||||
|
||||
for pattern, message, filter_func in regex_rules:
|
||||
|
|
|
@ -7,6 +7,7 @@ use azure::azure_hl::{AntialiasMode, Color,
|
|||
ColorPattern, CompositionOp};
|
||||
use euclid::size::Size2D;
|
||||
use azure::azure::AzIntSize;
|
||||
use azure::azure::{AzIntSize};
|
||||
|
||||
use std;
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ class CheckTidiness(unittest.TestCase):
|
|||
self.assertEqual('use statement spans multiple lines', errors.next()[2])
|
||||
self.assertEqual('missing space before }', errors.next()[2])
|
||||
self.assertTrue('use statement is not in alphabetical order' in errors.next()[2])
|
||||
self.assertEqual('use statement contains braces for single import', errors.next()[2])
|
||||
self.assertEqual('encountered whitespace following a use statement', errors.next()[2])
|
||||
self.assertTrue('mod declaration is not in alphabetical order' in errors.next()[2])
|
||||
self.assertEqual('mod declaration spans multiple lines', errors.next()[2])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue