@@ -87,17 +87,14 @@ declare_lint_pass!(UnusedResults => [UNUSED_MUST_USE, UNUSED_RESULTS]);
87
87
88
88
impl < ' tcx > LateLintPass < ' tcx > for UnusedResults {
89
89
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 ; } ;
94
91
95
92
if let hir:: ExprKind :: Ret ( ..) = expr. kind {
96
93
return ;
97
94
}
98
95
99
96
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 ) ;
101
98
102
99
let mut fn_warned = false ;
103
100
let mut op_warned = false ;
@@ -119,7 +116,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
119
116
_ => None ,
120
117
} ;
121
118
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 " , "" ) ;
123
120
} else if type_permits_lack_of_use {
124
121
// We don't warn about unused unit or uninhabited types.
125
122
// (See https://github.com/rust-lang/rust/issues/43806 for details.)
0 commit comments