about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--clippy_utils/src/eager_or_lazy.rs2
-rw-r--r--tests/ui/or_fun_call.fixed11
-rw-r--r--tests/ui/or_fun_call.rs11
3 files changed, 23 insertions, 1 deletions
diff --git a/clippy_utils/src/eager_or_lazy.rs b/clippy_utils/src/eager_or_lazy.rs
index 8724a4cd651..95b3e651e2b 100644
--- a/clippy_utils/src/eager_or_lazy.rs
+++ b/clippy_utils/src/eager_or_lazy.rs
@@ -120,7 +120,7 @@ fn expr_eagerness<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) -> EagernessS
                             .expr_ty(e)
                             .has_significant_drop(self.cx.tcx, self.cx.param_env)
                         {
-                            self.eagerness = Lazy;
+                            self.eagerness = ForceNoChange;
                             return;
                         }
                     },
diff --git a/tests/ui/or_fun_call.fixed b/tests/ui/or_fun_call.fixed
index 896430780ea..23b1aa8bebd 100644
--- a/tests/ui/or_fun_call.fixed
+++ b/tests/ui/or_fun_call.fixed
@@ -225,4 +225,15 @@ mod issue8239 {
     }
 }
 
+mod issue9608 {
+    fn sig_drop() {
+        enum X {
+            X(std::fs::File),
+            Y(u32),
+        }
+
+        let _ = None.unwrap_or(X::Y(0));
+    }
+}
+
 fn main() {}
diff --git a/tests/ui/or_fun_call.rs b/tests/ui/or_fun_call.rs
index 2473163d4fd..039998f22dd 100644
--- a/tests/ui/or_fun_call.rs
+++ b/tests/ui/or_fun_call.rs
@@ -225,4 +225,15 @@ mod issue8239 {
     }
 }
 
+mod issue9608 {
+    fn sig_drop() {
+        enum X {
+            X(std::fs::File),
+            Y(u32),
+        }
+
+        let _ = None.unwrap_or(X::Y(0));
+    }
+}
+
 fn main() {}