Skip to content

Conversation

relaxcn
Copy link
Contributor

@relaxcn relaxcn commented Aug 14, 2025

Fixes #15068

changelog: Fix [needless_range_loop] false positive and false negative when meeting multidimensional array

@rustbot
Copy link
Collaborator

rustbot commented Aug 14, 2025

r? @Jarcho

rustbot has assigned @Jarcho.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Aug 14, 2025
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Aug 15, 2025
@relaxcn relaxcn force-pushed the nrl branch 2 times, most recently from d647bf9 to afb5ebb Compare August 25, 2025 16:10
@relaxcn
Copy link
Contributor Author

relaxcn commented Aug 25, 2025

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties and removed S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) labels Aug 25, 2025
@@ -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)
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

@Jarcho Jarcho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jarcho Jarcho added this pull request to the merge queue Aug 30, 2025
Merged via the queue into rust-lang:master with commit 7fd0b9e Aug 30, 2025
11 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Aug 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

needless_range_loop falsely emmitted with nested indexing
3 participants