1 #![warn(clippy::drop_ref, clippy::forget_ref)]
2 #![allow(clippy::toplevel_ref_arg, clippy::similar_names, clippy::needless_pass_by_value)]
4 use std::mem::{drop, forget};
12 let mut owned1 = SomeStruct;
17 let mut owned2 = SomeStruct;
23 let reference1 = &SomeStruct;
27 let reference2 = &mut SomeStruct;
29 let reference3 = &mut SomeStruct;
32 let ref reference4 = SomeStruct;
38 fn test_generic_fn_drop<T>(val: T) {
44 fn test_generic_fn_forget<T>(val: T) {
50 fn test_similarly_named_function() {
51 fn drop<T>(_val: T) {}
52 drop(&SomeStruct); //OK; call to unrelated function which happens to have the same name
53 std::mem::drop(&SomeStruct);
54 fn forget<T>(_val: T) {}
55 forget(&SomeStruct); //OK; call to unrelated function which happens to have the same name
56 std::mem::forget(&SomeStruct);