diff options
| author | ljedrz <ljedrz@gmail.com> | 2018-08-03 10:19:22 +0200 |
|---|---|---|
| committer | ljedrz <ljedrz@gmail.com> | 2018-08-03 10:19:22 +0200 |
| commit | b68b3965a241e47c232613f403fbace64fd8b876 (patch) | |
| tree | f08775c6ea1e22d20212a459aa7774c8b2fe8786 /src/libsyntax | |
| parent | 7e8ca9f8bd8325398e76bc30ac09aab138bbb127 (diff) | |
| download | rust-b68b3965a241e47c232613f403fbace64fd8b876.tar.gz rust-b68b3965a241e47c232613f403fbace64fd8b876.zip | |
Don't collect() when size_hint is useless
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 28c1e4324de..6925ed2afb8 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -501,7 +501,11 @@ impl Pat { PatKind::Slice(pats, None, _) if pats.len() == 1 => pats[0].to_ty().map(TyKind::Slice)?, PatKind::Tuple(pats, None) => { - let tys = pats.iter().map(|pat| pat.to_ty()).collect::<Option<Vec<_>>>()?; + let mut tys = Vec::with_capacity(pats.len()); + // FIXME(#48994) - could just be collected into an Option<Vec> + for pat in pats { + tys.push(pat.to_ty()?); + } TyKind::Tup(tys) } _ => return None, |
