]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/tests/ui/eta.rs
Merge commit 'e329249b6a3a98830d860c74c8234a8dd9407436' into clippyup
[rust.git] / src / tools / clippy / tests / ui / eta.rs
index a759e6eb514b42bacb0254c704fe251902711890..5fdf7fb9771697e2330265458903ac5c12528f94 100644 (file)
@@ -256,3 +256,22 @@ fn arc_fp() {
     (0..5).map(|n| arc(n));
     Some(4).map(|n| ref_arc(n));
 }
+
+// #8460 Don't replace closures with params bounded as `ref`
+mod bind_by_ref {
+    struct A;
+    struct B;
+
+    impl From<&A> for B {
+        fn from(A: &A) -> Self {
+            B
+        }
+    }
+
+    fn test() {
+        // should not lint
+        Some(A).map(|a| B::from(&a));
+        // should not lint
+        Some(A).map(|ref a| B::from(a));
+    }
+}