aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorSamson <16504129+sagudev@users.noreply.github.com>2023-09-10 20:32:10 +0200
committerGitHub <noreply@github.com>2023-09-10 18:32:10 +0000
commit9b1247b20f2de6bbba39efff49eabc63e865ce2e (patch)
treeb645796558b72c3bbc6b3235c4c6a3d3c31b756d /python
parentd470955032967289f040800852dca044f3182aff (diff)
downloadservo-9b1247b20f2de6bbba39efff49eabc63e865ce2e.tar.gz
servo-9b1247b20f2de6bbba39efff49eabc63e865ce2e.zip
No extern crate test/tidy & better RUSTFLAGS handling in mach (#30328)
* Remove unused extern crate rustflag * Remove tidy check alphabetical order of extern crates rustfmt's reorder_imports already does that * fix * better RUSTFLAGS handling
Diffstat (limited to 'python')
-rw-r--r--python/servo/command_base.py9
-rw-r--r--python/tidy/test.py1
-rw-r--r--python/tidy/tidy.py17
3 files changed, 5 insertions, 22 deletions
diff --git a/python/servo/command_base.py b/python/servo/command_base.py
index 449c81bbf3d..137dfeea090 100644
--- a/python/servo/command_base.py
+++ b/python/servo/command_base.py
@@ -481,14 +481,16 @@ class CommandBase(object):
elif self.config["build"]["incremental"] is not None:
env["CARGO_INCREMENTAL"] = "0"
+ env['RUSTFLAGS'] = env.get('RUSTFLAGS', "")
+
if self.config["build"]["rustflags"]:
- env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + " " + self.config["build"]["rustflags"]
+ env['RUSTFLAGS'] += " " + self.config["build"]["rustflags"]
# Turn on rust's version of lld if we are on x86 Linux.
# TODO(mrobinson): Gradually turn this on for more platforms, when support stabilizes.
# See https://github.com/rust-lang/rust/issues/39915
if not self.cross_compile_target and effective_target == "x86_64-unknown-linux-gnu":
- env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + servo.platform.get().linker_flag()
+ env['RUSTFLAGS'] += " " + servo.platform.get().linker_flag()
if not (self.config["build"]["ccache"] == ""):
env['CCACHE'] = self.config["build"]["ccache"]
@@ -497,9 +499,8 @@ class CommandBase(object):
if self.cross_compile_target and (
self.cross_compile_target.startswith('arm')
or self.cross_compile_target.startswith('aarch64')):
- env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + " -C target-feature=+neon"
+ env['RUSTFLAGS'] += " -C target-feature=+neon"
- env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + " -W unused-extern-crates"
env["CARGO_TARGET_DIR"] = servo.util.get_target_dir()
if self.config["build"]["thinlto"]:
diff --git a/python/tidy/test.py b/python/tidy/test.py
index 5b6cff89988..5690b397a0c 100644
--- a/python/tidy/test.py
+++ b/python/tidy/test.py
@@ -108,7 +108,6 @@ class CheckTidiness(unittest.TestCase):
errors = tidy.collect_errors_for_files(iterFile('rust_tidy.rs'), [], [tidy.check_rust], print_text=False)
self.assertTrue('mod declaration is not in alphabetical order' in next(errors)[2])
self.assertEqual('mod declaration spans multiple lines', next(errors)[2])
- self.assertTrue('extern crate declaration is not in alphabetical order' in next(errors)[2])
self.assertTrue('derivable traits list is not in alphabetical order' in next(errors)[2])
self.assertEqual('found an empty line following a {', next(errors)[2])
self.assertEqual('use &[T] instead of &Vec<T>', next(errors)[2])
diff --git a/python/tidy/tidy.py b/python/tidy/tidy.py
index c79f086d747..a1c0e211a7c 100644
--- a/python/tidy/tidy.py
+++ b/python/tidy/tidy.py
@@ -538,7 +538,6 @@ def check_rust(file_name, lines):
prev_open_brace = False
multi_line_string = False
- prev_crate = {}
prev_mod = {}
prev_feature_name = ""
indent = 0
@@ -640,22 +639,6 @@ def check_rust(file_name, lines):
yield (idx + 1, "found an empty line following a {")
prev_open_brace = line.endswith("{")
- # check alphabetical order of extern crates
- if line.startswith("extern crate "):
- # strip "extern crate " from the begin and ";" from the end
- crate_name = line[13:-1]
- if indent not in prev_crate:
- prev_crate[indent] = ""
- if prev_crate[indent] > crate_name and check_alphabetical_order:
- yield(idx + 1, decl_message.format("extern crate declaration")
- + decl_expected.format(prev_crate[indent])
- + decl_found.format(crate_name))
- prev_crate[indent] = crate_name
-
- if line == "}":
- for i in [i for i in prev_crate.keys() if i > indent]:
- del prev_crate[i]
-
# check alphabetical order of feature attributes in lib.rs files
if is_lib_rs_file:
match = re.search(r"#!\[feature\((.*)\)\]", line)