Skip to content

Conversation

y21
Copy link
Member

@y21 y21 commented Jul 3, 2023

Closes #11084.

I realized that the fix I added in #11081 itself also causes an error in a suggestion when inside of a macro. Example:

macro_rules! x {
  () => {
    for _ in vec![1, 2] {}
  }
}
x!();

Here it would suggest replacing vec![1, 2] with [x!()], because that's what the source callsite is (reminder: it does this to get the correct span of x!() for code like for _ in vec![x!()]), but that's wrong when inside macros, so I decided to make it not lint if the whole loop construct is inside a macro to avoid this issue.

changelog: [useless_vec]: add more tests and don't lint inside of macros

r? @Alexendoo since these were your tests, I figured it makes most sense to assign you

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jul 3, 2023
@Alexendoo
Copy link
Member

Great, thanks!

@bors r+

@bors
Copy link
Contributor

bors commented Jul 3, 2023

📌 Commit b4549c5 has been approved by Alexendoo

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Jul 3, 2023

⌛ Testing commit b4549c5 with merge 3f4e599...

@bors
Copy link
Contributor

bors commented Jul 3, 2023

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: Alexendoo
Pushing 3f4e599 to master...

@bors bors merged commit 3f4e599 into rust-lang:master Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[useless_vec]: add more tests
4 participants