Skip to content

Commit 58cea33

Browse files
committed
Use lang items instead of get_trait_def_id where possible
1 parent a94b2c1 commit 58cea33

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

clippy_lints/src/doc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::utils::{get_trait_def_id, implements_trait, is_entrypoint_fn, match_type, paths, return_ty, span_lint};
1+
use crate::utils::{implements_trait, is_entrypoint_fn, match_type, paths, return_ty, span_lint};
22
use if_chain::if_chain;
33
use itertools::Itertools;
44
use rustc::lint::in_external_macro;
@@ -227,7 +227,7 @@ fn lint_for_missing_headers<'a, 'tcx>(
227227
} else {
228228
if_chain! {
229229
if let Some(body_id) = body_id;
230-
if let Some(future) = get_trait_def_id(cx, &paths::FUTURE);
230+
if let Some(future) = cx.tcx.lang_items().future_trait();
231231
let def_id = cx.tcx.hir().body_owner_def_id(body_id);
232232
let mir = cx.tcx.optimized_mir(def_id);
233233
let ret_ty = mir.return_ty();

clippy_lints/src/neg_cmp_op_on_partial_ord.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NoNegCompOpForPartialOrd {
6767
};
6868

6969
let implements_partial_ord = {
70-
if let Some(id) = utils::get_trait_def_id(cx, &paths::PARTIAL_ORD) {
70+
if let Some(id) = cx.tcx.lang_items().partial_ord_trait() {
7171
utils::implements_trait(cx, ty, id, &[])
7272
} else {
7373
return;

clippy_lints/src/utils/paths.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ pub const FMT_ARGUMENTS_NEW_V1_FORMATTED: [&str; 4] = ["core", "fmt", "Arguments
3636
pub const FMT_ARGUMENTV1_NEW: [&str; 4] = ["core", "fmt", "ArgumentV1", "new"];
3737
pub const FROM_FROM: [&str; 4] = ["core", "convert", "From", "from"];
3838
pub const FROM_TRAIT: [&str; 3] = ["core", "convert", "From"];
39-
pub const FUTURE: [&str; 3] = ["std", "future", "Future"];
4039
pub const HASH: [&str; 2] = ["hash", "Hash"];
4140
pub const HASHMAP: [&str; 5] = ["std", "collections", "hash", "map", "HashMap"];
4241
pub const HASHMAP_ENTRY: [&str; 5] = ["std", "collections", "hash", "map", "Entry"];
@@ -69,7 +68,6 @@ pub const ORD: [&str; 3] = ["core", "cmp", "Ord"];
6968
pub const OS_STRING: [&str; 4] = ["std", "ffi", "os_str", "OsString"];
7069
pub const OS_STRING_AS_OS_STR: [&str; 5] = ["std", "ffi", "os_str", "OsString", "as_os_str"];
7170
pub const OS_STR_TO_OS_STRING: [&str; 5] = ["std", "ffi", "os_str", "OsStr", "to_os_string"];
72-
pub const PARTIAL_ORD: [&str; 3] = ["core", "cmp", "PartialOrd"];
7371
pub const PATH: [&str; 3] = ["std", "path", "Path"];
7472
pub const PATH_BUF: [&str; 3] = ["std", "path", "PathBuf"];
7573
pub const PATH_BUF_AS_PATH: [&str; 4] = ["std", "path", "PathBuf", "as_path"];

0 commit comments

Comments
 (0)