-
Notifications
You must be signed in to change notification settings - Fork 1.6k
upper_case_acronyms warns on public items #6803
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Huh, does this still happen? This should have been "fixed" by #6788 . You mean the |
Thanks, it's a lot better after that! It still warns on variants of public enums though:
for the code pub enum ParseError<T> {
YDB(YDBError),
Utf8(std::string::FromUtf8Error),
Parse(T, String),
} |
upper_case_literals
off by defaultupper_case_acronyms: don't warn on public items Fixes #6803 changelog: upper_case_acronyms: ignore public items
@matthiaskrgr this still seems to be broken with nightly clippy:
|
These will hit stable in about 6 weeks, it's nice to fix them early. Note that this does not fix `clippy::upper_case_acronyms` since doing so would be a breaking change. See rust-lang/rust-clippy#6803 for more details. Here are the warnings that were previously emitted: ``` warning: unnecessary trailing semicolon --> src/simple_api/mod.rs:1172:10 | 1172 | }; | ^ help: remove this semicolon | = note: `#[warn(redundant_semicolons)]` on by default warning: panic message is not a string literal --> examples/threenp1.rs:127:30 | 127 | Err(x) => panic!(x), | ^ | = note: `#[warn(non_fmt_panic)]` on by default = note: this is no longer accepted in Rust 2021 help: add a "{}" format string to Display the message | 127 | Err(x) => panic!("{}", x), | ^^^^^ help: or use std::panic::panic_any instead | 127 | Err(x) => std::panic::panic_any(x), | ^^^^^^^^^^^^^^^^^^^^^^ error: name `YDB` contains a capitalized acronym --> src/context_api/mod.rs:747:5 | 747 | YDB(YDBError), | ^^^ help: consider making the acronym lowercase, except the initial letter: `Ydb` | = note: `-D clippy::upper-case-acronyms` implied by `-D clippy::all` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#upper_case_acronyms ```
The lint looked like this: ``` error: name `YDB` contains a capitalized acronym --> src/context_api/mod.rs:747:5 | 747 | YDB(YDBError), | ^^^ help: consider making the acronym lowercase, except the initial letter: `Ydb` | = note: `-D clippy::upper-case-acronyms` implied by `-D clippy::all` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#upper_case_acronyms ``` This is a bug in clippy: `YDB` is a public enum variant, and it would be a breaking change to change the name: rust-lang/rust-clippy#6803 This silences the lint until it's fixed upstream.
I recently ran nightly clippy on a project and got the following warning:
The lint is correct, it's not a false positive. However, fixing it would be a breaking change since
YDBError
is public. Maybe this lint should be off by default since it's only a style lint and it can be hard to fix?I originally just added
#[allow(clippy::upper_case_literals)]
, but that gives more warnings on stable until this rides the release trains unless I addallow(unknown_renamed_lints)
, which I'd rather not do.The text was updated successfully, but these errors were encountered: