1 #![warn(clippy::drop_copy, clippy::forget_copy)]
2 #![allow(clippy::toplevel_ref_arg, clippy::drop_ref, clippy::forget_ref, unused_mut)]
4 use std::mem::{drop, forget};
10 struct AnotherStruct {
16 impl Clone for AnotherStruct {
17 fn clone(&self) -> AnotherStruct {
27 let s1 = SomeStruct {};
45 let a1 = AnotherStruct {
51 let mut a3 = a1.clone();
69 #[allow(clippy::unit_cmp)]
71 fn println_and<T>(t: T) -> T {
77 0 => drop(println_and(12)), // Don't lint (copy type), we only care about side-effects
78 1 => drop(println_and(String::new())), // Don't lint (no copy type), we only care about side-effects
80 drop(println_and(13)); // Lint, even if we only care about the side-effect, it's already in a block
82 3 if drop(println_and(14)) == () => (), // Lint, idiomatic use is only in body of `Arm`
83 4 => drop(2), // Lint, not a fn/method call