matches: Simplify code
This commit is contained in:
parent
a0c5087520
commit
49ae73b450
@ -877,14 +877,7 @@ fn check_single_match_opt_like(
|
|||||||
fn collect_pat_paths(acc: &mut Vec<String>, pat: &Pat<'_>) -> bool {
|
fn collect_pat_paths(acc: &mut Vec<String>, pat: &Pat<'_>) -> bool {
|
||||||
match pat.kind {
|
match pat.kind {
|
||||||
PatKind::Wild => true,
|
PatKind::Wild => true,
|
||||||
PatKind::Tuple(inner, _) => {
|
PatKind::Tuple(inner, _) => inner.iter().all(|p| collect_pat_paths(acc, p)),
|
||||||
for p in inner {
|
|
||||||
if !collect_pat_paths(acc, p) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
true
|
|
||||||
},
|
|
||||||
PatKind::TupleStruct(ref path, ..) => {
|
PatKind::TupleStruct(ref path, ..) => {
|
||||||
acc.push(rustc_hir_pretty::to_string(rustc_hir_pretty::NO_ANN, |s| {
|
acc.push(rustc_hir_pretty::to_string(rustc_hir_pretty::NO_ANN, |s| {
|
||||||
s.print_qpath(path, false);
|
s.print_qpath(path, false);
|
||||||
|
Loading…
Reference in New Issue
Block a user