]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/escape_analysis.rs
Auto merge of #8374 - Alexendoo:bless-revisions, r=camsteffen
[rust.git] / tests / ui / escape_analysis.rs
index d435484d3e3d3f1a5e8cb864d17a7385f3548e6d..13e2b6c7a2e765a5a3d7269504368b6bc3bf8db0 100644 (file)
@@ -3,7 +3,8 @@
     clippy::borrowed_box,
     clippy::needless_pass_by_value,
     clippy::unused_unit,
-    clippy::redundant_clone
+    clippy::redundant_clone,
+    clippy::match_single_binding
 )]
 #![warn(clippy::boxed_local)]
 
@@ -100,7 +101,7 @@ fn warn_match() {
     let x = box A;
     match &x {
         // not moved
-        ref y => (),
+        y => (),
     }
 }
 
@@ -110,7 +111,7 @@ fn nowarn_large_array() {
     let x = box [1; 10000];
     match &x {
         // not moved
-        ref y => (),
+        y => (),
     }
 }
 
@@ -173,3 +174,31 @@ fn closure_borrow(x: Box<A>) {
         };
     }
 }
+
+/// Issue #5542
+///
+/// This shouldn't warn for `boxed_local` as it is intended to called from non-Rust code.
+pub extern "C" fn do_not_warn_me(_c_pointer: Box<String>) -> () {}
+
+#[rustfmt::skip] // Forces rustfmt to not add ABI
+pub extern fn do_not_warn_me_no_abi(_c_pointer: Box<String>) -> () {}
+
+// Issue #4804 - default implementation in trait
+mod issue4804 {
+    trait DefaultTraitImplTest {
+        // don't warn on `self`
+        fn default_impl(self: Box<Self>) -> u32 {
+            5
+        }
+
+        // warn on `x: Box<u32>`
+        fn default_impl_x(self: Box<Self>, x: Box<u32>) -> u32 {
+            4
+        }
+    }
+
+    trait WarnTrait {
+        // warn on `x: Box<u32>`
+        fn foo(x: Box<u32>) {}
+    }
+}