Skip to content

Commit beb7d29

Browse files
committed
refactor
1 parent 8ff171d commit beb7d29

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

clippy_lints/src/manual_partial_ord_and_ord_impl.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use clippy_utils::diagnostics::span_lint_and_then;
2-
use clippy_utils::{get_trait_def_id, path_res, ty::implements_trait};
2+
use clippy_utils::{get_trait_def_id, match_qpath, path_res, ty::implements_trait};
33
use rustc_errors::Applicability;
44
use rustc_hir::def::Res;
55
use rustc_hir::{Expr, ExprKind, Impl, ImplItemKind, Item, ItemKind, PatKind, QPath};
@@ -96,10 +96,8 @@ fn lint_impl_body(conf: &mut ManualPartialOrdAndOrdImpl, cx: &LateContext<'_>, i
9696
if_chain! {
9797
if block.stmts.is_empty();
9898
if let Some(expr) = block.expr;
99-
if let ExprKind::Call(Expr { kind: ExprKind::Path(path), ..}, [cmp_expr]) = expr.kind;
100-
if let QPath::Resolved(_, some_path) = path;
101-
if let Some(some_seg_one) = some_path.segments.get(0);
102-
if some_seg_one.ident.name == sym::Some;
99+
if let ExprKind::Call(Expr { kind: ExprKind::Path(some_path), ..}, [cmp_expr]) = expr.kind;
100+
if match_qpath(some_path, &["Some"]);
103101
if let ExprKind::MethodCall(cmp_path, _, [other_expr], ..) = cmp_expr.kind;
104102
if cmp_path.ident.name == sym::cmp;
105103
if let Res::Local(..) = path_res(cx, other_expr);

0 commit comments

Comments
 (0)