Skip to content
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

arithmetic_side_effects not triggered when add_assign used #12318

Closed
jayvdb opened this issue Feb 20, 2024 · 1 comment · Fixed by #12692
Closed

arithmetic_side_effects not triggered when add_assign used #12318

jayvdb opened this issue Feb 20, 2024 · 1 comment · Fixed by #12692
Assignees
Labels
C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't

Comments

@jayvdb
Copy link

jayvdb commented Feb 20, 2024

Summary

Where foo += 1 would trigger arithmetic_side_effects, the lint can be silenced by using foo.add_assign(1).

Likely this applies to all of the traits in https://doc.rust-lang.org/std/ops/index.html#traits

Lint Name

arithmetic_side_effects

Reproducer

No response

Version

rustc 1.76.0 (07dca489a 2024-02-04)
binary: rustc
commit-hash: 07dca489ac2d933c78d3c5158e3f43beefeb02ce
commit-date: 2024-02-04
host: x86_64-unknown-linux-gnu
release: 1.76.0
LLVM version: 17.0.6
@jayvdb jayvdb added C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't labels Feb 20, 2024
@c410-f3r
Copy link
Contributor

@rustbot claim

bors added a commit that referenced this issue Apr 22, 2024
[arithmetic_side_effects] Fix #12318

Fix #12318

changelog: [arithmetic_side_effects]: Consider method calls that correspond to arithmetic symbols
@bors bors closed this as completed in 2a4dae3 Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants