@@ -163,7 +163,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults {
163163 // Unions are also ignored (though in theory, we could lint if every field of
164164 // a union was `#[must_use]`).
165165 if def. variants . len ( ) == 1 && !def. is_union ( ) {
166- let fields = match & expr. node {
166+ let fields = match & expr. kind {
167167 hir:: ExprKind :: Struct ( _, fields, _) => {
168168 fields. iter ( ) . map ( |f| & * f. expr ) . collect ( )
169169 }
@@ -182,7 +182,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults {
182182 ( expr, span)
183183 } ;
184184 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 ) ;
186186 }
187187 }
188188 }
@@ -251,7 +251,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults {
251251 descr_pre,
252252 plural_suffix,
253253 ) ;
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 )
255257 }
256258 }
257259 _ => false ,
0 commit comments