2021-03-25 13:29:11 -05:00
|
|
|
error: this match could be written as a `let` statement
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/match_single_binding2.rs:17:36
|
2021-03-25 13:29:11 -05:00
|
|
|
|
|
|
|
|
LL | Some((iter, _item)) => match iter.size_hint() {
|
|
|
|
| ____________________________________^
|
|
|
|
LL | | (min, max) => (min.saturating_add(1), max.and_then(|max| max.checked_add(1))),
|
|
|
|
LL | | },
|
|
|
|
| |_____________^
|
|
|
|
|
|
|
|
|
= note: `-D clippy::match-single-binding` implied by `-D warnings`
|
2023-08-01 07:02:21 -05:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::match_single_binding)]`
|
2022-05-21 06:24:00 -05:00
|
|
|
help: consider using a `let` statement
|
2021-03-25 13:29:11 -05:00
|
|
|
|
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~ Some((iter, _item)) => {
|
|
|
|
LL + let (min, max) = iter.size_hint();
|
|
|
|
LL + (min.saturating_add(1), max.and_then(|max| max.checked_add(1)))
|
|
|
|
LL ~ },
|
2021-03-25 13:29:11 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
error: this match could be written as a `let` statement
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/match_single_binding2.rs:30:13
|
2021-03-25 13:29:11 -05:00
|
|
|
|
|
|
|
|
LL | / match get_tup() {
|
|
|
|
LL | | (a, b) => println!("a {:?} and b {:?}", a, b),
|
|
|
|
LL | | }
|
|
|
|
| |_____________^
|
|
|
|
|
|
2022-05-21 06:24:00 -05:00
|
|
|
help: consider using a `let` statement
|
2021-03-25 13:29:11 -05:00
|
|
|
|
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~ let (a, b) = get_tup();
|
2023-03-24 08:04:35 -05:00
|
|
|
LL + println!("a {:?} and b {:?}", a, b)
|
2021-03-25 13:29:11 -05:00
|
|
|
|
|
|
|
|
|
2021-05-20 05:30:31 -05:00
|
|
|
error: this match could be replaced by its scrutinee and body
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/match_single_binding2.rs:41:5
|
2021-05-20 05:30:31 -05:00
|
|
|
|
|
|
|
|
LL | / match side_effects() {
|
|
|
|
LL | | _ => println!("Side effects"),
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
help: consider using the scrutinee and body instead
|
|
|
|
|
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~ side_effects();
|
|
|
|
LL + println!("Side effects");
|
2021-05-20 05:30:31 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
error: this match could be replaced by its scrutinee and body
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/match_single_binding2.rs:48:5
|
2021-05-20 05:30:31 -05:00
|
|
|
|
|
|
|
|
LL | / match match x {
|
|
|
|
LL | | 0 => 1,
|
|
|
|
LL | | _ => 2,
|
|
|
|
LL | | } {
|
|
|
|
LL | | _ => println!("Single branch"),
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
help: consider using the scrutinee and body instead
|
|
|
|
|
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~ match x {
|
|
|
|
LL + 0 => 1,
|
|
|
|
LL + _ => 2,
|
|
|
|
LL + };
|
2023-03-24 08:04:35 -05:00
|
|
|
LL + println!("Single branch")
|
2021-05-20 05:30:31 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
error: aborting due to 4 previous errors
|
2021-03-25 13:29:11 -05:00
|
|
|
|