From 179e11ad8d834dbbc4fc14209ce0c9b169085df4 Mon Sep 17 00:00:00 2001 From: Daan Sprenkels Date: Sun, 30 Oct 2016 19:08:14 +0100 Subject: test-tidy: Check for space between function name and `(` Disallow an extraneous space in a function call between the function name and the opening parenthesis in Rust code, while ignoring macro declarations. This commit fixes #13980. --- python/tidy/servo_tidy/tidy.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'python/tidy/servo_tidy') diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py index 1dcbd4896d1..958a703c606 100644 --- a/python/tidy/servo_tidy/tidy.py +++ b/python/tidy/servo_tidy/tidy.py @@ -442,6 +442,13 @@ def check_rust(file_name, lines): regex_rules = [ (r",[^\s]", "missing space after ,", lambda match, line: '$' not in line and not is_attribute), + (r"([A-Za-z0-9_]+) (\()", "extra space after {0}", + lambda match, line: not ( + is_attribute or + re.match(r"\bmacro_rules!\s+", line[:match.start()]) or + re.search(r"[^']'[A-Za-z0-9_]+ \($", line[:match.end()]) or + match.group(1) in ['const', 'fn', 'for', 'if', 'in', + 'let', 'match', 'mut', 'return'])), (r"[A-Za-z0-9\"]=", "missing space before =", lambda match, line: is_attribute), (r"=[A-Za-z0-9\"]", "missing space after =", -- cgit v1.2.3