1 #![warn(clippy::drop_ref)]
2 #![allow(clippy::toplevel_ref_arg)]
11 let mut owned1 = SomeStruct;
17 let reference1 = &SomeStruct;
20 let reference2 = &mut SomeStruct;
23 let ref reference3 = SomeStruct;
28 fn test_generic_fn_drop<T>(val: T) {
34 fn test_similarly_named_function() {
35 fn drop<T>(_val: T) {}
36 drop(&SomeStruct); //OK; call to unrelated function which happens to have the same name
37 std::mem::drop(&SomeStruct);
40 #[derive(Copy, Clone)]
42 fn produce_half_owl_error() -> Result<(), Error> {
46 fn produce_half_owl_ok() -> Result<bool, ()> {
51 fn test_owl_result() -> Result<(), ()> {
52 produce_half_owl_error().map_err(|_| ())?;
53 produce_half_owl_ok().map(|_| ())?;
54 // the following should not be linted,
55 // we should not force users to use toilet closures
56 // to produce owl results when drop is more convenient
57 produce_half_owl_error().map_err(drop)?;
58 produce_half_owl_ok().map_err(drop)?;
63 fn test_owl_result_2() -> Result<u8, ()> {
64 produce_half_owl_error().map_err(|_| ())?;
65 produce_half_owl_ok().map(|_| ())?;
66 // the following should not be linted,
67 // we should not force users to use toilet closures
68 // to produce owl results when drop is more convenient
69 produce_half_owl_error().map_err(drop)?;
70 produce_half_owl_ok().map(drop)?;