Skip to content

Improve mut_mut and collapsible_if #1032

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

Merged
merged 6 commits into from
Jun 29, 2016
Merged

Improve mut_mut and collapsible_if #1032

merged 6 commits into from
Jun 29, 2016

Conversation

mcarton
Copy link
Member

@mcarton mcarton commented Jun 21, 2016

Fix #939.

@@ -1,6 +1,9 @@
# Change Log
All notable changes to this project will be documented in this file.

## 0.0.78 — TBD
* [`collapsible_if`] now consider `if let`
Copy link
Member

Choose a reason for hiding this comment

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

considers

let y : &mut &mut &mut u32 = &mut &mut &mut 2;
//~^ ERROR generally you want to avoid `&mut &mut
//~| ERROR generally you want to avoid `&mut &mut
//~| ERROR generally you want to avoid `&mut &mut
//~| ERROR generally you want to avoid `&mut &mut
//~| ERROR generally you want to avoid `&mut &mut
//~| ERROR generally you want to avoid `&mut &mut
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really need so many warnings?

Copy link
Member Author

Choose a reason for hiding this comment

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

The PR fixes an actual annoying bug with for _ in &mut bar but in this case also duplicates some errors. On the other hand &mut &mut &mut is such a corner case I did not think it would be worth it to try to deduplicate errors here.

@llogiq
Copy link
Contributor

llogiq commented Jun 22, 2016

The collapsible_if extension looks good to me. I'm unsure if the mut_mut change is completely an improvement, though. Can we do something to reduce the number of warnings it triggers for the same thing? Like e.g. only one warning per statement?

OTOH, with the new error formatting we probably don't need to care.

@mcarton
Copy link
Member Author

mcarton commented Jun 22, 2016

Actually it was just a matter of using the right visiting function. Done.

@llogiq
Copy link
Contributor

llogiq commented Jun 22, 2016

No, please roll back 472e7ca – this makes the lint ignore all level annotations below the crate level. I blogged about that problem quite some time ago.

@mcarton
Copy link
Member Author

mcarton commented Jun 29, 2016

Rebased and removed 472e7ca. Is it so bad that it reports duplicated commits on such convoluted example?

@llogiq llogiq merged commit d6e3fa8 into master Jun 29, 2016
@llogiq
Copy link
Contributor

llogiq commented Jun 29, 2016

I can fix it later.

@llogiq llogiq deleted the mut_mut branch June 29, 2016 18:41
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.

3 participants