mirror of
https://github.com/servo/servo.git
synced 2025-06-11 18:10:11 +00:00
Make test-tidy check that braces have spaces before or after them
This commit is contained in:
parent
aee011a524
commit
64ac4f175f
10 changed files with 31 additions and 21 deletions
|
@ -243,6 +243,16 @@ def check_rust(file_name, contents):
|
|||
if match:
|
||||
yield (idx + 1, "missing space before {")
|
||||
|
||||
# ignored cases like {} and }}
|
||||
match = re.search(r"[^\s{}]}", line)
|
||||
if match and not (line.startswith("use") or line.startswith("pub use")):
|
||||
yield (idx + 1, "missing space before }")
|
||||
|
||||
# ignored cases like {} and {{
|
||||
match = re.search(r"{[^\s{}]", line)
|
||||
if match and not (line.startswith("use") or line.startswith("pub use")):
|
||||
yield (idx + 1, "missing space after {")
|
||||
|
||||
# imports must be in the same line and alphabetically sorted
|
||||
if line.startswith("use "):
|
||||
use = line[4:]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue