Skip to content

Commit 91042db

Browse files
committed
Add path for display trait
1 parent 58cea33 commit 91042db

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

clippy_lints/src/inherent_to_string.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InherentToString {
120120
}
121121

122122
fn show_lint(cx: &LateContext<'_, '_>, item: &ImplItem<'_>) {
123-
let display_trait_id =
124-
get_trait_def_id(cx, &["core", "fmt", "Display"]).expect("Failed to get trait ID of `Display`!");
123+
let display_trait_id = get_trait_def_id(cx, &paths::DISPLAY_TRAIT).expect("Failed to get trait ID of `Display`!");
125124

126125
// Get the real type of 'self'
127126
let fn_def_id = cx.tcx.hir().local_def_id(item.hir_id);

clippy_lints/src/utils/paths.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pub const DEFAULT_TRAIT_METHOD: [&str; 4] = ["core", "default", "Default", "defa
2424
pub const DEREF_MUT_TRAIT_METHOD: [&str; 5] = ["core", "ops", "deref", "DerefMut", "deref_mut"];
2525
pub const DEREF_TRAIT_METHOD: [&str; 5] = ["core", "ops", "deref", "Deref", "deref"];
2626
pub const DISPLAY_FMT_METHOD: [&str; 4] = ["core", "fmt", "Display", "fmt"];
27+
pub const DISPLAY_TRAIT: [&str; 3] = ["core", "fmt", "Display"];
2728
pub const DOUBLE_ENDED_ITERATOR: [&str; 4] = ["core", "iter", "traits", "DoubleEndedIterator"];
2829
pub const DROP: [&str; 3] = ["core", "mem", "drop"];
2930
pub const DROP_TRAIT: [&str; 4] = ["core", "ops", "drop", "Drop"];

0 commit comments

Comments
 (0)