1

I cloned clippy and want to make my own standalone linting tool "myclippy" that should still be able to work besides clippy, but should also work without it.

I changed the names of the cargo-clippy and clippy-driver bins to "cargo-myclippy" and "myclippy-driver" in the cargo.toml file, as well as changed the project name.

I also changed attr_segments[0].ident.name == sym::clippy to attr_segments[0].ident.name.as_str() == "myclippy" in rust-clippy\clippy_utils\src\attrs.rs in the hope that this was what made "myclippy" check for clippy lints.

Then I removed all (most) lints in the clippy repository and added one of my own.

Next I built "myclippy" to an overriden toolchain with

cargo build --release --bin cargo-myclippy --bin myclippy-driver -Zunstable-options --out-dir "$(rustc --print=sysroot)/bin"

Then I run the new tool on a mock Rust project of mine which has at the start of the main.rs file:

#[warn(clippy::disallowed_methods)]

using the command:

cargo +nightly-2022-09-08-x86_64-pc-windows-msvc myclippy

I need this to work on projects for which I cannot change the code myself (and which reference clippy) as well, so removing this line is no option.

And the output I get:

warning: unknown lint: `clippy::disallowed_methods`
 --> src\main.rs:2:5
  |
2 |     clippy::disallowed_methods,
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unknown_lints)]` on by default

Why is "myclippy" still checking for clippy lints? I imagine that it would be possible to have a bunch of different linting tools on the same project and being able to run them independently of one another on that project.

How do I make it ignore all clippy references (and other tools) when my own "myclippy" tool is run?

The Coding Wombat
  • 805
  • 1
  • 10
  • 29

0 Answers0