2 #![warn(clippy::let_and_return)]
5 let _y = 0; // no warning
10 fn test_inner() -> i32 {
19 fn test_nowarn_1() -> i32 {
25 fn test_nowarn_2() -> i32 {
30 fn test_nowarn_3() -> (i32, i32) {
31 // this should technically warn, but we do not compare complex patterns
36 fn test_nowarn_4() -> i32 {
37 // this should technically warn, but not b/c of clippy::let_and_return, but b/c of useless type
42 fn test_nowarn_5(x: i16) -> u16 {
43 #[allow(clippy::cast_possible_truncation, clippy::cast_sign_loss)]
48 // False positive example
50 fn decode<D: std::io::Read>(d: D) -> Result<Self, ()>
55 macro_rules! tuple_encode {
57 impl<$($x: Decode),*> Decode for ($($x),*) {
59 #[allow(non_snake_case)]
60 fn decode<D: std::io::Read>(mut d: D) -> Result<Self, ()> {
61 // Shouldn't trigger lint
62 Ok(($({let $x = Decode::decode(&mut d)?; $x }),*))
68 tuple_encode!(T0, T1, T2, T3, T4, T5, T6, T7);