aboutsummaryrefslogtreecommitdiffstats
path: root/python/tidy/servo_tidy
diff options
context:
space:
mode:
Diffstat (limited to 'python/tidy/servo_tidy')
-rw-r--r--python/tidy/servo_tidy/tidy.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py
index 989b83aa505..3bf6176de44 100644
--- a/python/tidy/servo_tidy/tidy.py
+++ b/python/tidy/servo_tidy/tidy.py
@@ -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):