-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Fix FP of needless_range_loop
when meeting multidimensional array
#15486
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
Conversation
d647bf9
to
afb5ebb
Compare
@rustbot ready |
@@ -320,7 +346,7 @@ impl<'tcx> Visitor<'tcx> for VarVisitor<'_, 'tcx> { | |||
.and_then(|def_id| self.cx.tcx.trait_of_assoc(def_id)) | |||
&& ((meth.ident.name == sym::index && self.cx.tcx.lang_items().index_trait() == Some(trait_id)) | |||
|| (meth.ident.name == sym::index_mut && self.cx.tcx.lang_items().index_mut_trait() == Some(trait_id))) | |||
&& !self.check(args_1, args_0, expr) | |||
&& !self.check(args_1, args_0, 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.
nit: formatting error. The earlier comment causes rustfmt to give up. I would just delete it since it doesn't really say anything useful.
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.
Is it a bug in rustfmt?
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.
It doesn't handle comments inside an expression.
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.
Thank you for your explanation.
I have deleted the comment and performed fmt command.
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.
Thank you.
Fixes #15068
changelog: Fix [
needless_range_loop
] false positive and false negative when meeting multidimensional array