Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Centri3 committed May 16, 2023
1 parent ae4f7a7 commit 295b517
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions clippy_lints/src/manual_partial_ord_and_ord_impl.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use clippy_utils::diagnostics::span_lint_and_then;
use clippy_utils::{get_trait_def_id, path_res, ty::implements_trait};
use clippy_utils::{get_trait_def_id, match_qpath, path_res, ty::implements_trait};
use rustc_errors::Applicability;
use rustc_hir::def::Res;
use rustc_hir::{Expr, ExprKind, Impl, ImplItemKind, Item, ItemKind, PatKind, QPath};
Expand Down Expand Up @@ -96,10 +96,8 @@ fn lint_impl_body(conf: &mut ManualPartialOrdAndOrdImpl, cx: &LateContext<'_>, i
if_chain! {
if block.stmts.is_empty();
if let Some(expr) = block.expr;
if let ExprKind::Call(Expr { kind: ExprKind::Path(path), ..}, [cmp_expr]) = expr.kind;
if let QPath::Resolved(_, some_path) = path;
if let Some(some_seg_one) = some_path.segments.get(0);
if some_seg_one.ident.name == sym::Some;
if let ExprKind::Call(Expr { kind: ExprKind::Path(some_path), ..}, [cmp_expr]) = expr.kind;
if match_qpath(some_path, &["Some"]);
if let ExprKind::MethodCall(cmp_path, _, [other_expr], ..) = cmp_expr.kind;
if cmp_path.ident.name == sym::cmp;
if let Res::Local(..) = path_res(cx, other_expr);
Expand Down

0 comments on commit 295b517

Please sign in to comment.