-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
clippy nightly doesn't correctly fix CStr creation #13531
Labels
C-bug
Category: Clippy is not doing the correct thing
Comments
Note that non-nightly produces no warnings:
|
mutexlox-signal
added a commit
to mutexlox-signal/cubeb-coreaudio-rs
that referenced
this issue
Oct 10, 2024
Due to rust-lang/rust-clippy#13531, this incorrectly applies here on nightly builds of clippy -- it should not, since this project is on edition 2015 by default.
mutexlox-signal
added a commit
to mutexlox-signal/cubeb-pulse-rs
that referenced
this issue
Oct 10, 2024
If you run with |
mutexlox-signal
added a commit
to mutexlox-signal/cubeb-coreaudio-rs
that referenced
this issue
Oct 10, 2024
Due to rust-lang/rust-clippy#13531, this incorrectly applies here on nightly builds of clippy -- it should not, since this project is on edition 2015 by default.
mutexlox-signal
added a commit
to mutexlox-signal/cubeb-pulse-rs
that referenced
this issue
Oct 10, 2024
kinetiknz
pushed a commit
to mozilla/cubeb-pulse-rs
that referenced
this issue
Oct 10, 2024
kinetiknz
pushed a commit
to mozilla/cubeb-coreaudio-rs
that referenced
this issue
Oct 10, 2024
Due to rust-lang/rust-clippy#13531, this incorrectly applies here on nightly builds of clippy -- it should not, since this project is on edition 2015 by default.
bors
added a commit
that referenced
this issue
Oct 11, 2024
Only emit `manual_c_str_literals` in >= Edition 2021 Fixes #13531 changelog: none
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Summary
When running clippy's latest nightly, the automatically applied suggestion to use a CStr literal (https://rust-lang.github.io/rust-clippy/master/index.html#/manual_c_str_literals) incorrectly applies to projects on pre-2021 editions, causing
clippy --fix
to output non-compiling code.Reproducer
I tried this code:
with this Cargo.toml:
I ran
cargo +nightly clippy --fix --allow-dirty
I expected to see this happen:
No clippy warnings -- the edition is 2015, so c-str literals are not supported
Instead, this happened:
Version
rustc 1.83.0-nightly (eb4e23467 2024-10-09)
binary: rustc
commit-hash: eb4e2346748e1760f74fcaa27b42431e0b95f8f3
commit-date: 2024-10-09
host: aarch64-apple-darwin
release: 1.83.0-nightly
LLVM version: 19.1.1
Additional Labels
No response
The text was updated successfully, but these errors were encountered: