diff options
| author | bors <bors@rust-lang.org> | 2021-11-12 12:13:32 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-11-12 12:13:32 +0000 |
| commit | f31622a50b06e4e5775cf71d1dfe3e59ffc21aa5 (patch) | |
| tree | 8202dda112120cd6a08f0b1c2099e572c505509e /compiler/rustc_mir_build | |
| parent | e4c23daeb461ac02413eb36c8cefcc5530638a05 (diff) | |
| parent | a82692d6134b228c9d09396ce5e7e58d680e6d4f (diff) | |
| download | rust-f31622a50b06e4e5775cf71d1dfe3e59ffc21aa5.tar.gz rust-f31622a50b06e4e5775cf71d1dfe3e59ffc21aa5.zip | |
Auto merge of #90813 - notriddle:notriddle/vec-extend, r=GuillaumeGomez
Use Vec extend and collect instead of repeatedly calling push
Diffstat (limited to 'compiler/rustc_mir_build')
| -rw-r--r-- | compiler/rustc_mir_build/src/thir/pattern/usefulness.rs | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/compiler/rustc_mir_build/src/thir/pattern/usefulness.rs b/compiler/rustc_mir_build/src/thir/pattern/usefulness.rs index 067b0506e30..3ed434131b2 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/usefulness.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/usefulness.rs @@ -443,9 +443,7 @@ impl<'p, 'tcx> Matrix<'p, 'tcx> { /// expands it. fn push(&mut self, row: PatStack<'p, 'tcx>) { if !row.is_empty() && row.head().is_or_pat() { - for row in row.expand_or_pat() { - self.patterns.push(row); - } + self.patterns.extend(row.expand_or_pat()); } else { self.patterns.push(row); } |
