diff options
author | Cullen Rhodes <rhodes.cullen@gmail.com> | 2016-05-22 16:32:18 +0100 |
---|---|---|
committer | Cullen Rhodes <rhodes.cullen@gmail.com> | 2016-05-27 10:18:44 +0100 |
commit | 40acd24e8fef2a3c46ecdb21b4be1363d48e8ec4 (patch) | |
tree | a7786b1554ccc97240fdde367fe0ed5455c4c59f /python | |
parent | 4dcb05ca4f521b2c5eb12000678be035465e092b (diff) | |
download | servo-40acd24e8fef2a3c46ecdb21b4be1363d48e8ec4.tar.gz servo-40acd24e8fef2a3c46ecdb21b4be1363d48e8ec4.zip |
Report use statements that use {} with only one entry
Diffstat (limited to 'python')
-rw-r--r-- | python/tidy/servo_tidy/tidy.py | 2 | ||||
-rw-r--r-- | python/tidy/servo_tidy_tests/rust_tidy.rs | 1 | ||||
-rw-r--r-- | python/tidy/servo_tidy_tests/test_tidy.py | 1 |
3 files changed, 4 insertions, 0 deletions
diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py index 6ec263b2678..fa080890eb9 100644 --- a/python/tidy/servo_tidy/tidy.py +++ b/python/tidy/servo_tidy/tidy.py @@ -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: diff --git a/python/tidy/servo_tidy_tests/rust_tidy.rs b/python/tidy/servo_tidy_tests/rust_tidy.rs index 92db863dfaa..ef0a53b4b24 100644 --- a/python/tidy/servo_tidy_tests/rust_tidy.rs +++ b/python/tidy/servo_tidy_tests/rust_tidy.rs @@ -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; diff --git a/python/tidy/servo_tidy_tests/test_tidy.py b/python/tidy/servo_tidy_tests/test_tidy.py index 55dbb4ce21a..47c3d7780a3 100644 --- a/python/tidy/servo_tidy_tests/test_tidy.py +++ b/python/tidy/servo_tidy_tests/test_tidy.py @@ -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]) |