mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
tidy: add extra space after keyword check
This commit is contained in:
parent
17f99e2a7b
commit
c225847a81
3 changed files with 14 additions and 0 deletions
|
@ -584,6 +584,12 @@ def check_rust(file_name, lines):
|
|||
# -> () is unnecessary
|
||||
(r"-> \(\)", "encountered function signature with -> ()", no_filter),
|
||||
]
|
||||
keywords = ["if", "let", "mut", "extern", "as", "impl", "fn", "struct", "enum", "pub", "mod",
|
||||
"use", "in", "ref", "type", "where", "trait"]
|
||||
extra_space_after = lambda key: (r"(?<![A-Za-z0-9\-_]){key} ".format(key=key),
|
||||
"extra space after {key}".format(key=key),
|
||||
lambda match, line: not is_attribute)
|
||||
regex_rules.extend(map(extra_space_after, keywords))
|
||||
|
||||
for pattern, message, filter_func in regex_rules:
|
||||
for match in re.finditer(pattern, line):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue