7

Fix wrong config option being suggested for deprecated wrong_pub_self_convention...

 2 years ago
source link: https://github.com/rust-lang/rust-clippy/pull/7382
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Copy link

Member

matthiaskrgr commented 11 days ago

Problem:
for code like

#![warn(clippy::wrong_pub_self_convention)]
fn main() {
    println!("Hello, world!");
}

clippy will issue a warning to use a clippy.toml option instead:

warning: lint `clippy::wrong_pub_self_convention` has been removed: set the `avoid_breaking_exported_api` config option to `false` to enable the `wrong_self_convention` lint for public items
 --> src/main.rs:2:9
  |
2 | #![warn(clippy::wrong_pub_self_convention)]
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(renamed_and_removed_lints)]` on by default

But using the lint name as seen in the warning message
echo "avoid_breaking_exported_api = true\n" > clippy.toml

Will cause an error:

error: error reading Clippy's configuration file `/tmp/clippytest/clippy.toml`: unknown field `avoid_breaking_exported_api`, expected one of `avoid-breaking-exported-api`, ...

Replace the underscores with dashes in the deprecation message.

changelog: avoid_breaking_exported_api: suggest correct clippy config toml option in the deprecation message


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK