Skip to content

Commit

Permalink
chore(ci): remove clippy.sh
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
Gilad Chase committed Nov 12, 2024
1 parent f82884d commit ee13d10
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
13 changes: 8 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,17 @@ validator = "0.12"
void = "1.0.2"
zstd = "0.13.1"

# Note: both rust and clippy lints are warning by default and denied on the CI (see run_tests.py).
# To deny warnings in local dev env:
# - In the terminal: add to .bashrc `export RUSTFLAGS="$RUSTFLAGS -Dwarnings"
# - In vscode, add to settings.json "rust-analyzer.cargo.extraEnv": { "RUSTFLAGS": "-Dwarnings" }
[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"
8 changes: 0 additions & 8 deletions scripts/clippy.sh

This file was deleted.

14 changes: 10 additions & 4 deletions scripts/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ class BaseCommand(Enum):

def cmd(self, crates: Set[str]) -> List[str]:
package_args = []
operands = ["--", "-Dwarnings"] # "--" 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",
Expand All @@ -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
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.")

Expand Down

0 comments on commit ee13d10

Please sign in to comment.