about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--clippy_lints/src/unused_unit.rs1
-rw-r--r--tests/ui/unused_unit.edition2021.fixed8
-rw-r--r--tests/ui/unused_unit.edition2024.fixed8
-rw-r--r--tests/ui/unused_unit.rs8
4 files changed, 22 insertions, 3 deletions
diff --git a/clippy_lints/src/unused_unit.rs b/clippy_lints/src/unused_unit.rs
index 9859ddfdf7b..8ebfa3bf69b 100644
--- a/clippy_lints/src/unused_unit.rs
+++ b/clippy_lints/src/unused_unit.rs
@@ -109,6 +109,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedUnit {
             && let AssocItemConstraintKind::Equality { term: Term::Ty(hir_ty) } = constraints[0].kind
             && args.span_ext.hi() != poly.span.hi()
             && !hir_ty.span.from_expansion()
+            && args.span_ext.hi() != hir_ty.span.hi()
             && is_unit_ty(hir_ty)
         {
             lint_unneeded_unit_return(cx, hir_ty.span, poly.span);
diff --git a/tests/ui/unused_unit.edition2021.fixed b/tests/ui/unused_unit.edition2021.fixed
index 93dd58b8e9d..cb29688988a 100644
--- a/tests/ui/unused_unit.edition2021.fixed
+++ b/tests/ui/unused_unit.edition2021.fixed
@@ -143,4 +143,10 @@ mod issue14577 {
             todo!()
         }
     }
-}
\ No newline at end of file
+}
+
+mod pr_to_be_determined {
+    #[allow(unused_parens)]
+    type UnusedParensButNoUnit = Box<dyn (Fn())>;
+}
+
diff --git a/tests/ui/unused_unit.edition2024.fixed b/tests/ui/unused_unit.edition2024.fixed
index 987d901b97d..9870561ff03 100644
--- a/tests/ui/unused_unit.edition2024.fixed
+++ b/tests/ui/unused_unit.edition2024.fixed
@@ -143,4 +143,10 @@ mod issue14577 {
             todo!()
         }
     }
-}
\ No newline at end of file
+}
+
+mod pr_to_be_determined {
+    #[allow(unused_parens)]
+    type UnusedParensButNoUnit = Box<dyn (Fn())>;
+}
+
diff --git a/tests/ui/unused_unit.rs b/tests/ui/unused_unit.rs
index b7645f7b6a2..23421764b35 100644
--- a/tests/ui/unused_unit.rs
+++ b/tests/ui/unused_unit.rs
@@ -143,4 +143,10 @@ mod issue14577 {
             todo!()
         }
     }
-}
\ No newline at end of file
+}
+
+mod pr_to_be_determined {
+    #[allow(unused_parens)]
+    type UnusedParensButNoUnit = Box<dyn (Fn())>;
+}
+