2 Lint for redundant pattern matching over `Result`, `Option`,
3 `std::task::Poll` or `std::net::IpAddr`
6 It's more concise and clear to just use the proper
10 This will change the drop order for the matched type. Both `if let` and
11 `while let` will drop the value at the end of the block, both `if` and `while` will drop the
12 value before entering the block. For most types this change will not matter, but for a few
13 types this will not be an acceptable change (e.g. locks). See the
14 [reference](https://doc.rust-lang.org/reference/destructors.html#drop-scopes) for more about
19 if let Ok(_) = Ok::<i32, i32>(42) {}
20 if let Err(_) = Err::<i32, i32>(42) {}
21 if let None = None::<()> {}
22 if let Some(_) = Some(42) {}
23 if let Poll::Pending = Poll::Pending::<()> {}
24 if let Poll::Ready(_) = Poll::Ready(42) {}
25 if let IpAddr::V4(_) = IpAddr::V4(Ipv4Addr::LOCALHOST) {}
26 if let IpAddr::V6(_) = IpAddr::V6(Ipv6Addr::LOCALHOST) {}
27 match Ok::<i32, i32>(42) {
33 The more idiomatic use would be:
36 if Ok::<i32, i32>(42).is_ok() {}
37 if Err::<i32, i32>(42).is_err() {}
38 if None::<()>.is_none() {}
39 if Some(42).is_some() {}
40 if Poll::Pending::<()>.is_pending() {}
41 if Poll::Ready(42).is_ready() {}
42 if IpAddr::V4(Ipv4Addr::LOCALHOST).is_ipv4() {}
43 if IpAddr::V6(Ipv6Addr::LOCALHOST).is_ipv6() {}
44 Ok::<i32, i32>(42).is_ok();