@@ -87,17 +87,14 @@ declare_lint_pass!(UnusedResults => [UNUSED_MUST_USE, UNUSED_RESULTS]);
8787
8888impl < ' tcx > LateLintPass < ' tcx > for UnusedResults {
8989 fn check_stmt ( & mut self , cx : & LateContext < ' _ > , s : & hir:: Stmt < ' _ > ) {
90- let expr = match s. kind {
91- hir:: StmtKind :: Semi ( ref expr) => & * * expr,
92- _ => return ,
93- } ;
90+ let hir:: StmtKind :: Semi ( expr) = s. kind else { return ; } ;
9491
9592 if let hir:: ExprKind :: Ret ( ..) = expr. kind {
9693 return ;
9794 }
9895
9996 let ty = cx. typeck_results ( ) . expr_ty ( & expr) ;
100- let type_permits_lack_of_use = check_must_use_ty ( cx, ty, & expr, s . span , "" , "" , 1 ) ;
97+ let type_permits_lack_of_use = check_must_use_ty ( cx, ty, & expr, expr . span , "" , "" , 1 ) ;
10198
10299 let mut fn_warned = false ;
103100 let mut op_warned = false ;
@@ -119,7 +116,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
119116 _ => None ,
120117 } ;
121118 if let Some ( def_id) = maybe_def_id {
122- fn_warned = check_must_use_def ( cx, def_id, s . span , "return value of " , "" ) ;
119+ fn_warned = check_must_use_def ( cx, def_id, expr . span , "return value of " , "" ) ;
123120 } else if type_permits_lack_of_use {
124121 // We don't warn about unused unit or uninhabited types.
125122 // (See https://github.com/rust-lang/rust/issues/43806 for details.)
0 commit comments