Merge commit 'aa0d551351' into clippy-subtree-update

This commit is contained in:
Philipp Krones 2024-10-03 16:32:51 +02:00
parent 4891dd4627
commit 277c4e4baf
183 changed files with 2484 additions and 848 deletions

View file

@ -275,12 +275,15 @@ fn transform_with_focus_on_idx(alternatives: &mut ThinVec<P<Pat>>, focus_idx: us
|k, ps1, idx| matches!(
k,
TupleStruct(qself2, path2, ps2)
if eq_maybe_qself(qself1, qself2) && eq_path(path1, path2) && eq_pre_post(ps1, ps2, idx)
if eq_maybe_qself(qself1.as_ref(), qself2.as_ref())
&& eq_path(path1, path2) && eq_pre_post(ps1, ps2, idx)
),
|k| always_pat!(k, TupleStruct(_, _, ps) => ps),
),
// Transform a record pattern `S { fp_0, ..., fp_n }`.
Struct(qself1, path1, fps1, rest1) => extend_with_struct_pat(qself1, path1, fps1, *rest1, start, alternatives),
Struct(qself1, path1, fps1, rest1) => {
extend_with_struct_pat(qself1.as_ref(), path1, fps1, *rest1, start, alternatives)
},
};
alternatives[focus_idx].kind = focus_kind;
@ -292,7 +295,7 @@ fn transform_with_focus_on_idx(alternatives: &mut ThinVec<P<Pat>>, focus_idx: us
/// So when we fixate on some `ident_k: pat_k`, we try to find `ident_k` in the other pattern
/// and check that all `fp_i` where `i ∈ ((0...n) \ k)` between two patterns are equal.
fn extend_with_struct_pat(
qself1: &Option<P<ast::QSelf>>,
qself1: Option<&P<ast::QSelf>>,
path1: &ast::Path,
fps1: &mut [ast::PatField],
rest1: ast::PatFieldsRest,
@ -307,7 +310,7 @@ fn extend_with_struct_pat(
|k| {
matches!(k, Struct(qself2, path2, fps2, rest2)
if rest1 == *rest2 // If one struct pattern has `..` so must the other.
&& eq_maybe_qself(qself1, qself2)
&& eq_maybe_qself(qself1, qself2.as_ref())
&& eq_path(path1, path2)
&& fps1.len() == fps2.len()
&& fps1.iter().enumerate().all(|(idx_1, fp1)| {