-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[methods] Move lints from strings.rs to methods module (#14253) #14362
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
base: master
Are you sure you want to change the base?
[methods] Move lints from strings.rs to methods module (#14253) #14362
Conversation
Hi, I'm getting this error:
-error: calling
-error: calling error: diagnostic code error: diagnostic code I can't understand.. I have to change the code of the test? |
Thanks for the refactoring. The problem here you are encountering here is twofold:
This is done so because to keep the method checking lints simple and less sensitive to subtle bugs, it is simpler to avoid dealing with expanded code. However, in your case, the One possibility would be to apply a commit such as samueltardieu@2e77605 on top of your commit: this introduces the possibility to run some methods lint even in the presence of expansion. Those lints are then in charge of properly checking their context and make sure they behave properly. |
let ty = cx.typeck_results().expr_ty(receiver); | ||
|
||
// &str -> String | ||
if let ty::Ref(_, ty, ..) = ty.kind() { // Usa ty::Ref invece di rustc_middle::ty::TyKind::Ref |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments in Clippy source code are in English.
expr: &'tcx Expr<'_>, | ||
method_name: &str, | ||
receiver: &'tcx Expr<'_>, | ||
_args: &[Expr<'_>], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should simply remove unused args.
☔ The latest upstream changes (possibly d28d234) made this pull request unmergeable. Please resolve the merge conflicts. |
changelog: [
refactor-strings-lints
]: Move lints (except for: string_add, string_add_assign and string_slice (which share an implementation) fromclippy_lints/src/strings.rs
to themethods
module to share tree traversal with other method and function call lints. Fixes #14253.fixes #14253