mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Auto merge of #10713 - aeischeid:master, r=jdm
add tidy test for space after ":" in stucts Addresses issue #10702 the tidy self-test doesn't seem to catch the `member_name:"Foo"` line like it should. the regex follows similar pattern in the file and works in my regex tester tool, so not really sure what is going on there. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10713) <!-- Reviewable:end -->
This commit is contained in:
commit
8c2c0bd964
3 changed files with 9 additions and 2 deletions
|
@ -336,7 +336,8 @@ def check_rust(file_name, lines):
|
|||
|
||||
# get rid of strings and chars because cases like regex expression, keep attributes
|
||||
if not line_is_attribute(line):
|
||||
line = re.sub(r'"(\\.|[^\\"])*?"|' + r"'(\\.|[^\\'])*?'", '', line)
|
||||
line = re.sub(r'"(\\.|[^\\"])*?"', '""', line)
|
||||
line = re.sub(r"'(\\.|[^\\'])*?'", "''", line)
|
||||
|
||||
# get rid of comments
|
||||
line = re.sub('//.*?$|/\*.*?$|^\*.*?$', '', line)
|
||||
|
@ -373,7 +374,7 @@ def check_rust(file_name, lines):
|
|||
(r" :[^:]", "extra space before :",
|
||||
lambda match, line: 'trait ' not in line[:match.start()]),
|
||||
# ignore "crate::mod" and ignore flagging macros like "$t1:expr"
|
||||
(r"[^:]:[A-Za-z]", "missing space after :",
|
||||
(r"[^:]:[A-Za-z0-9\"]", "missing space after :",
|
||||
lambda match, line: '$' not in line[:match.end()]),
|
||||
(r"[A-Za-z0-9\)]{", "missing space before {{", no_filter),
|
||||
# ignore cases like "{}", "}`", "}}" and "use::std::{Foo, Bar}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue