]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/unit_return_expecting_ord.rs
Auto merge of #9148 - arieluy:then_some_unwrap_or, r=Jarcho
[rust.git] / clippy_lints / src / unit_return_expecting_ord.rs
index f58da7ce9b42078b9d48ef7e3dd524db3bf8bcad..b0fce91abeb7d3fd44cd750321140aafa1d97454 100644 (file)
@@ -2,7 +2,7 @@
 use clippy_utils::{get_trait_def_id, paths};
 use if_chain::if_chain;
 use rustc_hir::def_id::DefId;
-use rustc_hir::{Expr, ExprKind, StmtKind};
+use rustc_hir::{Closure, Expr, ExprKind, StmtKind};
 use rustc_lint::{LateContext, LateLintPass};
 use rustc_middle::ty;
 use rustc_middle::ty::{GenericPredicates, PredicateKind, ProjectionPredicate, TraitPredicate};
@@ -116,7 +116,7 @@ fn get_args_to_check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) -> Ve
 
 fn check_arg<'tcx>(cx: &LateContext<'tcx>, arg: &'tcx Expr<'tcx>) -> Option<(Span, Option<Span>)> {
     if_chain! {
-        if let ExprKind::Closure { body, fn_decl_span, .. } = arg.kind;
+        if let ExprKind::Closure(&Closure { body, fn_decl_span, .. }) = arg.kind;
         if let ty::Closure(_def_id, substs) = &cx.typeck_results().node_type(arg.hir_id).kind();
         let ret_ty = substs.as_closure().sig().output();
         let ty = cx.tcx.erase_late_bound_regions(ret_ty);