From 9144e78670e53b129388f709d7dc4d78439963a5 Mon Sep 17 00:00:00 2001 From: Gilad Chase Date: Sun, 10 Nov 2024 15:55:20 +0200 Subject: [PATCH] chore(ci): remove clippy.sh - Only one source of truth for lints, main Cargo.toml, making clippy.sh unnecessary. - Warnings no longer denied, only in the CI. To preserve existing behaviors users can add `-Dwarnings` to local RUSTFLAGS. We still need to enforce in workspace tests that all crates inherit workspace lints. --- Cargo.toml | 9 ++++----- scripts/clippy.sh | 8 -------- scripts/run_tests.py | 14 ++++++++++---- 3 files changed, 14 insertions(+), 17 deletions(-) delete mode 100755 scripts/clippy.sh diff --git a/Cargo.toml b/Cargo.toml index 2b5f598c2c..f22503416b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -251,13 +251,12 @@ void = "1.0.2" zstd = "0.13.1" [workspace.lints.rust] -future-incompatible = "deny" -nonstandard-style = "deny" -rust-2018-idioms = "deny" +future-incompatible = "warn" +nonstandard-style = "warn" +rust-2018-idioms = "warn" # See [here](https://github.com/taiki-e/cargo-llvm-cov/issues/370) for a discussion on why this is # needed (from rust 1.80). unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage_nightly)'] } -warnings = "deny" [workspace.lints.clippy] -as_conversions = "deny" +as_conversions = "warn" diff --git a/scripts/clippy.sh b/scripts/clippy.sh deleted file mode 100755 index 3eaef6844c..0000000000 --- a/scripts/clippy.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -# TODO: Revert clippy::unwrap_used to -D after fixing all the unwraps. -cargo clippy --all-targets --all-features $@ -- \ - -D future-incompatible \ - -D nonstandard-style \ - -D rust-2018-idioms \ - -D unused \ diff --git a/scripts/run_tests.py b/scripts/run_tests.py index 6f20328809..f1bfb1c155 100755 --- a/scripts/run_tests.py +++ b/scripts/run_tests.py @@ -25,11 +25,12 @@ class BaseCommand(Enum): def cmd(self, crates: Set[str]) -> List[str]: package_args = [] + operands = ["--", "-Dwarning"] # "--" must be the first element. for package in crates: package_args.extend(["--package", package]) if self == BaseCommand.TEST: - return ["cargo", "test"] + package_args + return ["cargo", "test"] + package_args + operands elif self == BaseCommand.CODECOV: return [ "cargo", @@ -40,14 +41,19 @@ def cmd(self, crates: Set[str]) -> List[str]: "codecov.json", ] + package_args elif self == BaseCommand.RUSTFMT: + operands += ["--check"] fmt_args = package_args if len(package_args) > 0 else ["--all"] - return ["scripts/rust_fmt.sh"] + fmt_args + ["--", "--check"] + return ["scripts/rust_fmt.sh"] + fmt_args + operands elif self == BaseCommand.CLIPPY: clippy_args = package_args if len(package_args) > 0 else ["--workspace"] - return ["scripts/clippy.sh"] + clippy_args + return ["cargo", "clippy"] + clippy_args + operands elif self == BaseCommand.DOC: doc_args = package_args if len(package_args) > 0 else ["--workspace"] - return ["cargo", "doc", "-r", "--document-private-items", "--no-deps"] + doc_args + return ( + ["cargo", "doc", "-r", "--document-private-items", "--no-deps"] + + doc_args + + operands + ) raise NotImplementedError(f"Command {self} not implemented.")