disallowed_methods for different versions of dependency without allow-invalid
#16400
|
I'm trying to add disallowed-methods to a clippy.toml in a workspace. The workspace uses multiple versions of a dependency, and an API path changed between the versions, so the resulting TOML looks similar to this: disallowed-methods = [
{ path = "foo::Bar::baz" }, # crate foo v1 exports Bar at the crate root
{ path = "foo::bar::Bar::baz" }, # crate foo v2 exports Bar from the bar module
]This generates warnings on one of the items, usually the newer version The workaround is to add How do I write the fully qualified path for |
Replies: 1 comment 1 reply
|
You can't. Clippy has no versioned path form like Use both layouts and set disallowed-methods = [
{ path = "foo::Bar::baz", allow-invalid = true },
{ path = "foo::bar::Bar::baz", allow-invalid = true },
]Clippy runs per crate. A package that only depends on Related: #17006 Pitfall: Cargo renames do not help. Clippy matches the crate's real name, not the alias. Version pinning in config would need a Clippy feature request. |
You can't. Clippy has no versioned path form like
foo@1::…. Paths are plaincrate::module::Item.Use both layouts and set
allow-invalid = true:Clippy runs per crate. A package that only depends on
foov1 never sees the v2 path, so it warns unless you allow invalid. Same the other way for v2-only packages. The ban still applies when the path does resolve.Related: #17006
Pitfall: Cargo renames do not help. Clippy matches the crate's real name, not the alias.
Version pinning in config would need a Clippy feature request.