diff options
| author | flip1995 <hello@philkrones.com> | 2020-03-03 10:53:14 +0100 |
|---|---|---|
| committer | flip1995 <hello@philkrones.com> | 2020-03-03 10:54:30 +0100 |
| commit | 91042db2e8976174d3e568f7ce780a15322847f6 (patch) | |
| tree | 741f5534cc0cd8d82db914256ace0ef132467500 | |
| parent | 58cea334ec1ef959e8ae54627feb1850b051faac (diff) | |
| download | rust-91042db2e8976174d3e568f7ce780a15322847f6.tar.gz rust-91042db2e8976174d3e568f7ce780a15322847f6.zip | |
Add path for display trait
| -rw-r--r-- | clippy_lints/src/inherent_to_string.rs | 3 | ||||
| -rw-r--r-- | clippy_lints/src/utils/paths.rs | 1 |
2 files changed, 2 insertions, 2 deletions
diff --git a/clippy_lints/src/inherent_to_string.rs b/clippy_lints/src/inherent_to_string.rs index 10fe8f28eab..24c0b1cb80e 100644 --- a/clippy_lints/src/inherent_to_string.rs +++ b/clippy_lints/src/inherent_to_string.rs @@ -120,8 +120,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InherentToString { } fn show_lint(cx: &LateContext<'_, '_>, item: &ImplItem<'_>) { - let display_trait_id = - get_trait_def_id(cx, &["core", "fmt", "Display"]).expect("Failed to get trait ID of `Display`!"); + let display_trait_id = get_trait_def_id(cx, &paths::DISPLAY_TRAIT).expect("Failed to get trait ID of `Display`!"); // Get the real type of 'self' let fn_def_id = cx.tcx.hir().local_def_id(item.hir_id); diff --git a/clippy_lints/src/utils/paths.rs b/clippy_lints/src/utils/paths.rs index cffdb218cde..5ec04d965c8 100644 --- a/clippy_lints/src/utils/paths.rs +++ b/clippy_lints/src/utils/paths.rs @@ -24,6 +24,7 @@ pub const DEFAULT_TRAIT_METHOD: [&str; 4] = ["core", "default", "Default", "defa pub const DEREF_MUT_TRAIT_METHOD: [&str; 5] = ["core", "ops", "deref", "DerefMut", "deref_mut"]; pub const DEREF_TRAIT_METHOD: [&str; 5] = ["core", "ops", "deref", "Deref", "deref"]; pub const DISPLAY_FMT_METHOD: [&str; 4] = ["core", "fmt", "Display", "fmt"]; +pub const DISPLAY_TRAIT: [&str; 3] = ["core", "fmt", "Display"]; pub const DOUBLE_ENDED_ITERATOR: [&str; 4] = ["core", "iter", "traits", "DoubleEndedIterator"]; pub const DROP: [&str; 3] = ["core", "mem", "drop"]; pub const DROP_TRAIT: [&str; 4] = ["core", "ops", "drop", "Drop"]; |
