-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better documentation for disallowed_method lint #7479
Comments
Saw this commit |
I believe local methods still can't be used with this lint. For example, in a crate called fn f() { }
fn g() {
f();
} And with the following disallowed-methods = [
"f"
] The call in Using |
As the |
Besides, I may want to disallow trait method for a specific implementation. Given - trait A { fn f (); }
Struct B; impl A for B { ... }
Struct C; impl A for C { ... } I'd like to forbit |
I checked this way works now (may be related to #8852) and even with nested mod. My issue is the comment above #7479 (comment) |
Note: Today (Rust 1.81, though it's probably worked for a while), this works in [[disallowed-methods]]
path = "std::fs::rename"
reason = "Use fs_err::rename" However, the documentation only includes examples for methods on types, not methods on modules, so we should clean that up. |
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.The text was updated successfully, but these errors were encountered: