-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Mark writes to constants as side-effect-less #3595
Mark writes to constants as side-effect-less #3595
Conversation
5d66f83
to
7a0e132
Compare
7a0e132
to
847898f
Compare
clippy_lints/src/no_effect.rs
Outdated
ExprKind::Assign(ref left, ref right) => { | ||
if has_no_effect(cx, left) { | ||
let mut left = left; | ||
while let ExprKind::Field(f, _) = &left.node { |
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.
We can unwrap a few other expressions, too. Index would be one i can think of. There may be others, too.
Okay, I added |
@bors r+ Thanks |
📌 Commit 9fe8a3e has been approved by |
… r=oli-obk Mark writes to constants as side-effect-less This is my first real contribution, so I probably did it wrong.
☀️ Test successful - status-appveyor, status-travis |
Move constant write checks to temporary_assignment lint They make more sense here cc #3595
This is my first real contribution, so I probably did it wrong.