diff --git a/clippy_lints/src/serde.rs b/clippy_lints/src/serde.rs index c916ad3c514..adfe99363d3 100644 --- a/clippy_lints/src/serde.rs +++ b/clippy_lints/src/serde.rs @@ -1,6 +1,6 @@ use rustc::lint::*; use rustc::hir::*; -use utils::{span_lint, get_trait_def_id}; +use utils::{span_lint, get_trait_def_id, paths}; /// **What it does:** This lint checks for mis-uses of the serde API /// @@ -28,7 +28,7 @@ impl LateLintPass for Serde { fn check_item(&mut self, cx: &LateContext, item: &Item) { if let ItemImpl(_, _, _, Some(ref trait_ref), _, ref items) = item.node { let did = cx.tcx.expect_def(trait_ref.ref_id).def_id(); - if let Some(visit_did) = get_trait_def_id(cx, &["serde", "de", "Visitor"]) { + if let Some(visit_did) = get_trait_def_id(cx, &paths::SERDE_DE_VISITOR) { if did == visit_did { let mut seen_str = None; let mut seen_string = None; diff --git a/clippy_lints/src/utils/paths.rs b/clippy_lints/src/utils/paths.rs index 3c91578abd0..be4fa0f6203 100644 --- a/clippy_lints/src/utils/paths.rs +++ b/clippy_lints/src/utils/paths.rs @@ -55,6 +55,7 @@ pub const REGEX_NEW: [&'static str; 4] = ["regex", "re_unicode", "Regex", "new"] pub const REGEX_SET_NEW: [&'static str; 5] = ["regex", "re_set", "unicode", "RegexSet", "new"]; pub const RESULT: [&'static str; 3] = ["core", "result", "Result"]; pub const STRING: [&'static str; 3] = ["collections", "string", "String"]; +pub const SERDE_DE_VISITOR: [&'static str; 3] = ["serde", "de", "Visitor"]; pub const TRANSMUTE: [&'static str; 4] = ["core", "intrinsics", "", "transmute"]; pub const VEC: [&'static str; 3] = ["collections", "vec", "Vec"]; pub const VEC_DEQUE: [&'static str; 3] = ["collections", "vec_deque", "VecDeque"];