diff options
Diffstat (limited to 'tests/ui/unnecessary_clone.rs')
| -rw-r--r-- | tests/ui/unnecessary_clone.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/ui/unnecessary_clone.rs b/tests/ui/unnecessary_clone.rs index 90dd65a1d42..12ac96aa64c 100644 --- a/tests/ui/unnecessary_clone.rs +++ b/tests/ui/unnecessary_clone.rs @@ -21,25 +21,34 @@ fn clone_on_ref_ptr() { let arc_weak = Arc::downgrade(&arc); rc.clone(); + //~^ ERROR: using `.clone()` on a ref-counted pointer + //~| NOTE: `-D clippy::clone-on-ref-ptr` implied by `-D warnings` Rc::clone(&rc); arc.clone(); + //~^ ERROR: using `.clone()` on a ref-counted pointer Arc::clone(&arc); rcweak.clone(); + //~^ ERROR: using `.clone()` on a ref-counted pointer rc::Weak::clone(&rcweak); arc_weak.clone(); + //~^ ERROR: using `.clone()` on a ref-counted pointer sync::Weak::clone(&arc_weak); let x = Arc::new(SomeImpl); let _: Arc<dyn SomeTrait> = x.clone(); + //~^ ERROR: using `.clone()` on a ref-counted pointer } fn clone_on_copy_generic<T: Copy>(t: T) { t.clone(); + //~^ ERROR: using `clone` on type `T` which implements the `Copy` trait + //~| NOTE: `-D clippy::clone-on-copy` implied by `-D warnings` Some(t).clone(); + //~^ ERROR: using `clone` on type `Option<T>` which implements the `Copy` trait } mod many_derefs { @@ -74,6 +83,7 @@ mod many_derefs { fn go1() { let a = A; let _: E = a.clone(); + //~^ ERROR: using `clone` on type `E` which implements the `Copy` trait let _: E = *****a; } } @@ -93,5 +103,6 @@ mod issue2076 { fn func() -> Option<Rc<u8>> { let rc = Rc::new(42); Some(try_opt!(Some(rc)).clone()) + //~^ ERROR: using `.clone()` on a ref-counted pointer } } |
