rust-clippy icon indicating copy to clipboard operation
rust-clippy copied to clipboard

Unknown lint `arithmetic_side_effects` (`rustc` warning)

Open Rudxain opened this issue 3 years ago • 4 comments

Description

I don't know if I should report this issue here or at /rust-lang/rust/. I was reading the docs, and found clippy::arithmetic_side_effects, set it to level warn, and rustc says that it can't recognize it. Why does this happen?

Version

rustc 1.63.0 (4b91a6ea7 2022-08-08)
binary: rustc
commit-hash: 4b91a6ea7258a947e59c6522cd5898e7c0a6a88f
commit-date: 2022-08-08
host: x86_64-unknown-linux-gnu
release: 1.63.0
LLVM version: 14.0.5

Additional Labels

No response

Rudxain avatar Sep 20 '22 02:09 Rudxain

arithmetic_side_effects was added in rust 1.64, I assume this is the issue, but a reproducible example would be needed.

kraktus avatar Sep 20 '22 06:09 kraktus

arithmetic_side_effects was added in rust 1.64, I assume this is the issue, but a reproducible example would be needed.

Oh right, I'm gonna close the issue then. Sorry for the inconvenience.

BTW, I ran rustup update && rustup upgrade, but it didn't update the version. ~Am I doing something wrong?~

And why is redundant_clone related to arithmetic_side_effects?

Update: I've read that v1.64 will be released in ~2 days from now, that explains why rustup didn't update

Rudxain avatar Sep 20 '22 09:09 Rudxain

I've updated to rustc 1.64, yet I still get the warning, even after cargo clean.

The weird thing is that cargo build and cargo check show no warnings, but cargo clippy and rust-analyzer do. I'm using VScode, and I've set a config to run cargo clippy instead of cargo check:

{"rust-analyzer.checkOnSave.command": "clippy"}

New rustc -Vv output:

rustc 1.64.0 (a55dd71d5 2022-09-19)
binary: rustc
commit-hash: a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52
commit-date: 2022-09-19
host: x86_64-unknown-linux-gnu
release: 1.64.0
LLVM version: 14.0.6

Rudxain avatar Sep 23 '22 10:09 Rudxain

What is your clippy version?

kraktus avatar Sep 23 '22 11:09 kraktus

Output of cargo clippy -V

clippy 0.1.64 (a55dd71 2022-09-19)

Rudxain avatar Sep 24 '22 20:09 Rudxain

Can confirm – same versions as OP, also running VSCode with rust-analyzer. I'm on macOS if it makes any difference.

KizzyCode avatar Sep 27 '22 19:09 KizzyCode

I notice the lint was renamed from arithmetic to arithmetic_side_effects on September 9th (https://github.com/rust-lang/rust-clippy/commit/51d8b6c6643abb048987bd0befdeb6f46db0f6b5). It looks like Clippy v0.1.64 contains the old name:

// works
#![warn(clippy::arithmetic)]

// error: unknown lint: `clippy::arithmetic_side_effects`
#![warn(clippy::arithmetic_side_effects)]

Seems like a documentation bug that the name is updated immediately even if it stabilized under a different name.

jmillikin avatar Oct 17 '22 11:10 jmillikin

This issue can be closed.

c410-f3r avatar Jan 13 '23 18:01 c410-f3r