5 #![deny(clippy, clippy_pedantic)]
12 fn add(self, other: T) -> T { self } //~ERROR defining a method called `add`
13 fn drop(&mut self) { } //~ERROR defining a method called `drop`
15 fn sub(&self, other: T) -> &T { self } // no error, self is a ref
16 fn div(self) -> T { self } // no error, different #arguments
17 fn rem(self, other: T) { } // no error, wrong return type
19 fn into_u32(self) -> u32 { 0 } // fine
20 fn into_u16(&self) -> u16 { 0 } //~ERROR methods called `into_*` usually take self by value
22 fn to_something(self) -> u32 { 0 } //~ERROR methods called `to_*` usually take self by reference
29 fn to_something(self) -> u32 { 0 } // ok because U is Copy
34 fn mul(self, other: T) -> T { self } // no error, obviously
39 let _ = opt.unwrap(); //~ERROR used unwrap() on an Option
41 let res: Result<i32, ()> = Ok(0);
42 let _ = res.unwrap(); //~ERROR used unwrap() on a Result
44 let _ = "str".to_string(); //~ERROR `"str".to_owned()` is faster
47 let string = v.to_string(); //~ERROR `(*v).to_owned()` is faster
48 let _again = string.to_string(); //~ERROR `String.to_string()` is a no-op