@@ -163,7 +163,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults {
163
163
// Unions are also ignored (though in theory, we could lint if every field of
164
164
// a union was `#[must_use]`).
165
165
if def. variants . len ( ) == 1 && !def. is_union ( ) {
166
- let fields = match & expr. node {
166
+ let fields = match & expr. kind {
167
167
hir:: ExprKind :: Struct ( _, fields, _) => {
168
168
fields. iter ( ) . map ( |f| & * f. expr ) . collect ( )
169
169
}
@@ -182,7 +182,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults {
182
182
( expr, span)
183
183
} ;
184
184
has_emitted |= check_must_use_ty (
185
- cx, ty, expr, span, descr_pre, descr_post, plural ) ;
185
+ cx, ty, expr, span, descr_pre, descr_post, plural_len ) ;
186
186
}
187
187
}
188
188
}
@@ -251,7 +251,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults {
251
251
descr_pre,
252
252
plural_suffix,
253
253
) ;
254
- check_must_use_ty ( cx, ty, expr, span, descr_pre, descr_post, n as usize + 1 )
254
+ // `2` is just a stand-in for a number greater than 1, for correct plurals
255
+ // in diagnostics.
256
+ check_must_use_ty ( cx, ty, expr, span, descr_pre, descr_post, 2 )
255
257
}
256
258
}
257
259
_ => false ,
0 commit comments