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