Skip to content

Commit 5e476ba

Browse files
Rollup merge of #152265 - lapla-cogito:tytuple_agg, r=Zalathar
Use `.map.collect` to aggregate in `.to_ty` of tuples Since #48994 might have been resolved, we can address the FIXME.
2 parents 723eb92 + b5cd820 commit 5e476ba

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

compiler/rustc_ast/src/ast.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -656,11 +656,7 @@ impl Pat {
656656
// A tuple pattern `(P0, .., Pn)` can be reparsed as `(T0, .., Tn)`
657657
// assuming `T0` to `Tn` are all syntactically valid as types.
658658
PatKind::Tuple(pats) => {
659-
let mut tys = ThinVec::with_capacity(pats.len());
660-
// FIXME(#48994) - could just be collected into an Option<Vec>
661-
for pat in pats {
662-
tys.push(pat.to_ty()?);
663-
}
659+
let tys = pats.iter().map(|pat| pat.to_ty()).collect::<Option<ThinVec<_>>>()?;
664660
TyKind::Tup(tys)
665661
}
666662
_ => return None,

0 commit comments

Comments
 (0)