Skip to content

Commit

Permalink
py-format
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Mar 12, 2023
1 parent d96e5e7 commit 90db9bf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions scripts/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def test_lint_line() -> None:
for line in should_error:
assert lint_line(line) is not None, f'expected "{line}" to fail'


# -----------------------------------------------------------------------------

re_declaration = re.compile(r"^\s*((pub(\(\w*\))? )?((impl|fn|struct|enum|union|trait|type)\b))")
Expand Down Expand Up @@ -138,10 +139,10 @@ def is_empty(line: str) -> bool:
if is_empty(prev_line):
return False

if line.startswith('fn ') and line.endswith(";"):
if line.startswith("fn ") and line.endswith(";"):
return False # maybe a trait function

if line.startswith('type ') and prev_line.endswith(";"):
if line.startswith("type ") and prev_line.endswith(";"):
return False # many type declarations in a row is fine

if prev_line.endswith(",") and line.startswith("impl"):
Expand Down Expand Up @@ -236,6 +237,7 @@ def test_lint_vertical_spacing() -> None:

pass


# -----------------------------------------------------------------------------


Expand Down

0 comments on commit 90db9bf

Please sign in to comment.