mirror of
https://github.com/servo/servo.git
synced 2025-06-14 11:24:33 +00:00
Tighten up checks for spaces around colons to deal with trait inheritance syntax.
This commit is contained in:
parent
8bb853f643
commit
a147cbe0c1
3 changed files with 12 additions and 10 deletions
|
@ -232,9 +232,11 @@ def check_rust(file_name, contents):
|
|||
if match:
|
||||
yield (idx + 1, "missing space after ->")
|
||||
|
||||
# Avoid flagging ::crate::mod
|
||||
if line.find(" :[^:]") != -1:
|
||||
yield (idx + 1, "extra space before :")
|
||||
# Avoid flagging ::crate::mod and `trait Foo : Bar`
|
||||
match = line.find(" :")
|
||||
if match != -1:
|
||||
if line[0:match].find('trait ') == -1 and line[match + 2] != ':':
|
||||
yield (idx + 1, "extra space before :")
|
||||
|
||||
# Avoid flagging crate::mod
|
||||
match = re.search(r"[^:]:[A-Za-z]", line)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue