mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-25 04:23:22 +00:00
82afb16179
Clippy has an internal lint that checks for the usage of hardcoded def paths and suggests to replace them with a lang or diagnostic item, if possible. This was implemented with a hack, by getting all the variants of the `LangItem` enum and then index into it with the position of the `LangItem` in the `items` list. This is no longer possible, because the `items` list can't be accessed anymore.
27 lines
1.1 KiB
Text
27 lines
1.1 KiB
Text
error: hardcoded path to a diagnostic item
|
|
--> $DIR/unnecessary_def_path_hardcoded_path.rs:10:36
|
|
|
|
|
LL | const DEREF_TRAIT: [&str; 4] = ["core", "ops", "deref", "Deref"];
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: convert all references to use `sym::Deref`
|
|
= note: `-D clippy::unnecessary-def-path` implied by `-D warnings`
|
|
|
|
error: hardcoded path to a diagnostic item
|
|
--> $DIR/unnecessary_def_path_hardcoded_path.rs:12:43
|
|
|
|
|
LL | const DEREF_TRAIT_METHOD: [&str; 5] = ["core", "ops", "deref", "Deref", "deref"];
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: convert all references to use `sym::deref_method`
|
|
|
|
error: hardcoded path to a language item
|
|
--> $DIR/unnecessary_def_path_hardcoded_path.rs:11:40
|
|
|
|
|
LL | const DEREF_MUT_TRAIT: [&str; 4] = ["core", "ops", "deref", "DerefMut"];
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: convert all references to use `LangItem::DerefMut`
|
|
|
|
error: aborting due to 3 previous errors
|
|
|