Skip to content

Commit a8d6eda

Browse files
committed
use get_trait_def_id to check for Ord trait
1 parent 068acbd commit a8d6eda

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

clippy_lints/src/derive.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::utils::paths;
22
use crate::utils::{
3-
is_automatically_derived, is_copy, match_path, span_lint_and_help, span_lint_and_note, span_lint_and_then,
3+
get_trait_def_id, is_automatically_derived, is_copy, match_path, span_lint_and_help, span_lint_and_note, span_lint_and_then,
44
};
55
use if_chain::if_chain;
66
use rustc_hir::def_id::DefId;
@@ -211,9 +211,10 @@ fn check_ord_pord<'tcx>(
211211
ord_is_automatically_derived: bool,
212212
) {
213213
if_chain! {
214-
if match_path(&trait_ref.path, &paths::ORD);
214+
if let Some(ord_trait_def_id) = get_trait_def_id(cx, &paths::ORD);
215215
if let Some(pord_trait_def_id) = cx.tcx.lang_items().partial_ord_trait();
216216
if let Some(def_id) = &trait_ref.trait_def_id();
217+
if *def_id == ord_trait_def_id;
217218
if !def_id.is_local();
218219
then {
219220
// Look for the PartialOrd implementations for `ty`

0 commit comments

Comments
 (0)