]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/clippy_lints/src/unit_types/let_unit_value.rs
Rollup merge of #102454 - chenyukang:fix-102396-missing-parentheses, r=lcnr
[rust.git] / src / tools / clippy / clippy_lints / src / unit_types / let_unit_value.rs
index 35824b03170afb87e139373715ad3b1caca492e5..ce9ebad8c89a85e98687ef486fc410dca262993f 100644 (file)
@@ -19,10 +19,12 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, local: &'tcx Local<'_>) {
         && cx.typeck_results().pat_ty(local.pat).is_unit()
     {
         if (local.ty.map_or(false, |ty| !matches!(ty.kind, TyKind::Infer))
-            || matches!(local.pat.kind, PatKind::Tuple([], None)))
+            || matches!(local.pat.kind, PatKind::Tuple([], ddpos) if ddpos.as_opt_usize().is_none()))
             && expr_needs_inferred_result(cx, init)
         {
-            if !matches!(local.pat.kind, PatKind::Wild | PatKind::Tuple([], None)) {
+            if !matches!(local.pat.kind, PatKind::Wild)
+               && !matches!(local.pat.kind, PatKind::Tuple([], ddpos) if ddpos.as_opt_usize().is_none())
+            {
                 span_lint_and_then(
                     cx,
                     LET_UNIT_VALUE,