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