disallowed_methods configuration for traits with generics
#16401
|
What's the correct syntax for referring to a trait method with Clippy's In this, How do I write the fully qualified path for both of these (or some singular path that refers to both) that Clippy will understand? If I force it to be an invalid path by changing the function name to something garbage, Clippy does not give me a warning that the path is invalid, so I know this syntax isn't correct. disallowed-methods = [
{ path = "<heapless::index_map::IndexMap as core::iter::Extend>::invalid" }, # note: invalid method name to test whether this path syntax is correct
] |
Replies: 1 comment
|
Use the trait method path. Generics and UFCS are not supported: disallowed-methods = [
{ path = "core::iter::Extend::extend", reason = "..." },
]That one path covers every You cannot limit it to only Pitfall: a path that starts with |
Use the trait method path. Generics and UFCS are not supported:
That one path covers every
Extend::extendcall (owned pairs, ref pairs, any type). Generics never go in the path.You cannot limit it to only
IndexMaptoday.heapless::index_map::IndexMap::extendonly finds inherent methods, and<Type as Trait>::methodis not parsed. Tracked here: #8581Pitfall: a path that starts with
<never resolves, and Clippy often skips the invalid-path warning because the first segment looks like an unloaded crate.