aboutsummaryrefslogtreecommitdiffstats
path: root/python/tidy/servo_tidy/tidy.py
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2018-11-07 08:47:57 -0500
committerGitHub <noreply@github.com>2018-11-07 08:47:57 -0500
commitda2d9b2228441863feba2af2a60f84d2657fb962 (patch)
tree760c0eb675e95b46890480a9e10bc2c2cc714512 /python/tidy/servo_tidy/tidy.py
parent618a790050d8eab39e3c44b3d39dfefa7648445e (diff)
parent1855c88d6106c73febec1f5f29e246a75ff2f849 (diff)
downloadservo-da2d9b2228441863feba2af2a60f84d2657fb962.tar.gz
servo-da2d9b2228441863feba2af2a60f84d2657fb962.zip
Auto merge of #22126 - pyfisch:autoformat, r=jdm
Enforce rustfmt on CI <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22126) <!-- Reviewable:end -->
Diffstat (limited to 'python/tidy/servo_tidy/tidy.py')
-rw-r--r--python/tidy/servo_tidy/tidy.py32
1 files changed, 0 insertions, 32 deletions
diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py
index 9059c1f9843..f8def74e57c 100644
--- a/python/tidy/servo_tidy/tidy.py
+++ b/python/tidy/servo_tidy/tidy.py
@@ -509,10 +509,8 @@ def check_rust(file_name, lines):
is_lib_rs_file = file_name.endswith("lib.rs")
- prev_use = None
prev_open_brace = False
multi_line_string = False
- current_indent = 0
prev_crate = {}
prev_mod = {}
prev_feature_name = ""
@@ -716,36 +714,6 @@ def check_rust(file_name, lines):
# not a feature attribute line, so empty previous name
prev_feature_name = ""
- # imports must be in the same line, alphabetically sorted, and merged
- # into a single import block
- if line.startswith("use "):
- import_block = True
- if not line.endswith(";") and '{' in line:
- yield (idx + 1, "use statement spans multiple lines")
- if '{ ' in line:
- yield (idx + 1, "extra space after {")
- if ' }' in line:
- yield (idx + 1, "extra space before }")
- # strip "use" from the begin and ";" from the end
- current_use = line[4:-1]
- if prev_use:
- current_use_cut = current_use.replace("{self,", ".").replace("{", ".")
- prev_use_cut = prev_use.replace("{self,", ".").replace("{", ".")
- if indent == current_indent and current_use_cut < prev_use_cut and check_alphabetical_order:
- yield(idx + 1, decl_message.format("use statement")
- + decl_expected.format(prev_use)
- + decl_found.format(current_use))
- prev_use = current_use
- current_indent = indent
-
- if whitespace or not import_block:
- current_indent = 0
-
- # do not allow blank lines in an import block
- if import_block and whitespace and line.startswith("use "):
- whitespace = False
- yield(idx, "encountered whitespace following a use statement")
-
# modules must be in the same line and alphabetically sorted
if line.startswith("mod ") or line.startswith("pub mod "):
# strip /(pub )?mod/ from the left and ";" from the right