Skip to content

Commit 8276f26

Browse files
committed
Fix wrong config option being suggested for deprecated wrong_pub_self_convention lint
Problem: for code like ```` 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
1 parent 3120b09 commit 8276f26

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

clippy_lints/src/deprecated_lints.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ declare_deprecated_lint! {
149149
/// enables the `enum_variant_names` lint for public items.
150150
/// ```
151151
pub PUB_ENUM_VARIANT_NAMES,
152-
"set the `avoid_breaking_exported_api` config option to `false` to enable the `enum_variant_names` lint for public items"
152+
"set the `avoid-breaking-exported-api` config option to `false` to enable the `enum_variant_names` lint for public items"
153153
}
154154

155155
declare_deprecated_lint! {
@@ -158,5 +158,5 @@ declare_deprecated_lint! {
158158
/// **Deprecation reason:** The `avoid_breaking_exported_api` config option was added, which
159159
/// enables the `wrong_self_conversion` lint for public items.
160160
pub WRONG_PUB_SELF_CONVENTION,
161-
"set the `avoid_breaking_exported_api` config option to `false` to enable the `wrong_self_convention` lint for public items"
161+
"set the `avoid-breaking-exported-api` config option to `false` to enable the `wrong_self_convention` lint for public items"
162162
}

clippy_lints/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -484,11 +484,11 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
484484
);
485485
store.register_removed(
486486
"clippy::pub_enum_variant_names",
487-
"set the `avoid_breaking_exported_api` config option to `false` to enable the `enum_variant_names` lint for public items",
487+
"set the `avoid-breaking-exported-api` config option to `false` to enable the `enum_variant_names` lint for public items",
488488
);
489489
store.register_removed(
490490
"clippy::wrong_pub_self_convention",
491-
"set the `avoid_breaking_exported_api` config option to `false` to enable the `wrong_self_convention` lint for public items",
491+
"set the `avoid-breaking-exported-api` config option to `false` to enable the `wrong_self_convention` lint for public items",
492492
);
493493
// end deprecated lints, do not remove this comment, it’s used in `update_lints`
494494

tests/ui/deprecated.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,13 @@ error: lint `clippy::filter_map` has been removed: this lint has been replaced b
8484
LL | #[warn(clippy::filter_map)]
8585
| ^^^^^^^^^^^^^^^^^^
8686

87-
error: lint `clippy::pub_enum_variant_names` has been removed: set the `avoid_breaking_exported_api` config option to `false` to enable the `enum_variant_names` lint for public items
87+
error: lint `clippy::pub_enum_variant_names` has been removed: set the `avoid-breaking-exported-api` config option to `false` to enable the `enum_variant_names` lint for public items
8888
--> $DIR/deprecated.rs:15:8
8989
|
9090
LL | #[warn(clippy::pub_enum_variant_names)]
9191
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9292

93-
error: 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
93+
error: 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
9494
--> $DIR/deprecated.rs:16:8
9595
|
9696
LL | #[warn(clippy::wrong_pub_self_convention)]

0 commit comments

Comments
 (0)