Skip to content

Commit fc54a91

Browse files
committed
add the path to the util::path module
1 parent 319c66a commit fc54a91

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

clippy_lints/src/serde.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use rustc::lint::*;
22
use rustc::hir::*;
3-
use utils::{span_lint, get_trait_def_id};
3+
use utils::{span_lint, get_trait_def_id, paths};
44

55
/// **What it does:** This lint checks for mis-uses of the serde API
66
///
@@ -28,7 +28,7 @@ impl LateLintPass for Serde {
2828
fn check_item(&mut self, cx: &LateContext, item: &Item) {
2929
if let ItemImpl(_, _, _, Some(ref trait_ref), _, ref items) = item.node {
3030
let did = cx.tcx.expect_def(trait_ref.ref_id).def_id();
31-
if let Some(visit_did) = get_trait_def_id(cx, &["serde", "de", "Visitor"]) {
31+
if let Some(visit_did) = get_trait_def_id(cx, &paths::SERDE_DE_VISITOR) {
3232
if did == visit_did {
3333
let mut seen_str = None;
3434
let mut seen_string = None;

clippy_lints/src/utils/paths.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ pub const REGEX_NEW: [&'static str; 4] = ["regex", "re_unicode", "Regex", "new"]
5555
pub const REGEX_SET_NEW: [&'static str; 5] = ["regex", "re_set", "unicode", "RegexSet", "new"];
5656
pub const RESULT: [&'static str; 3] = ["core", "result", "Result"];
5757
pub const STRING: [&'static str; 3] = ["collections", "string", "String"];
58+
pub const SERDE_DE_VISITOR: [&'static str; 3] = ["serde", "de", "Visitor"];
5859
pub const TRANSMUTE: [&'static str; 4] = ["core", "intrinsics", "", "transmute"];
5960
pub const VEC: [&'static str; 3] = ["collections", "vec", "Vec"];
6061
pub const VEC_DEQUE: [&'static str; 3] = ["collections", "vec_deque", "VecDeque"];

0 commit comments

Comments
 (0)