1 #![warn(clippy::collapsible_match)]
3 clippy::needless_return,
6 clippy::needless_borrow
9 fn lint_cases(opt_opt: Option<Option<u32>>, res_opt: Result<Option<u32>, String>) {
10 // if guards on outer match
13 Ok(val) if make() => match val {
20 Ok(val) => match val {
24 _ if make() => return,
32 ($outer:expr => $pat:pat, $e:expr => $inner_pat:pat, $then:expr) => {
42 // Lint this since the patterns are not defined by the macro.
43 // Allows the lint to work on if_chain! for example.
44 // Fixing the lint requires knowledge of the specific macro, but we optimistically assume that
45 // there is still a better way to write this.
46 mac!(res_opt => Ok(val), val => Some(n), foo(n));
49 // deref reference value
58 // ref pattern and deref
60 Some(ref s) => match &*s {
69 // deref inner value (cannot pattern match with Vec)
83 fn foo<T, U>(t: T) -> U {