Open
Description
https://rust-lang.github.io/rust-clippy/master/#disallowed_method
Doc on All Clippy Lints shows the example of how to use it with methods from the standard library, but no example on how to use it with user-defined types neither if this is possible to use with methods of user-defined types/imported items.
When I tried to use this with nightly-2021-07-06
in rust-toolchain I managed to get it to work with std::vec::Vec::append, but no luck with user-defined methods.
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
juliancoffee commentedon Jul 24, 2021
Saw this commit
70ce0c2
if I understand correctly, this is worked on currently?
Zenithsiz commentedon Feb 2, 2022
I believe local methods still can't be used with this lint.
For example, in a crate called
my_crate
with the following contents:And with the following
clippy.toml
The call in
g
isn't warned about.Using
crate::f
,my_crate::f
and::my_crate::f
also doesn't work.tisonkun commentedon Aug 4, 2023
As the
clippy.toml
can be defined for workspace, I supposemy_crate::f
should work as a design (but it doesn't work yet).tisonkun commentedon Aug 4, 2023
Besides, I may want to disallow trait method for a specific implementation. Given -
I'd like to forbit
B.f()
but notC.f()
. It seems now we all resolved toA::f()
.tisonkun commentedon Aug 4, 2023
I checked this way works now (may be related to #8852) and even with nested mod. My issue is the comment above #7479 (comment)
9999years commentedon Oct 16, 2024
Note: Today (Rust 1.81, though it's probably worked for a while), this works in
clippy.toml
:However, the documentation only includes examples for methods on types, not methods on modules, so we should clean that up.