diff options
| author | bors <bors@rust-lang.org> | 2022-08-31 21:45:18 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-08-31 21:45:18 +0000 |
| commit | db00199d999dae0e549ff11cfed6d7dee3d4583c (patch) | |
| tree | ed304653161d9f230c39724aa94f80925923654d /compiler/rustc_data_structures/src | |
| parent | 9243168fa5615ec8ebe9164c6bc2fdcccffd08b6 (diff) | |
| parent | 14d216d33bae1b2d9c252fad6338a5481c2e8a53 (diff) | |
| download | rust-db00199d999dae0e549ff11cfed6d7dee3d4583c.tar.gz rust-db00199d999dae0e549ff11cfed6d7dee3d4583c.zip | |
Auto merge of #101249 - matthiaskrgr:rollup-wahnoz8, r=matthiaskrgr
Rollup of 10 pull requests Successful merges: - #100787 (Pretty printing give proper error message without panic) - #100838 (Suggest moving redundant generic args of an assoc fn to its trait) - #100844 (migrate rustc_query_system to use SessionDiagnostic) - #101140 (Update Clippy) - #101161 (Fix uintended diagnostic caused by `drain(..)`) - #101165 (Use more `into_iter` rather than `drain(..)`) - #101229 (Link “? operator” to relevant chapter in The Book) - #101230 (lint: avoid linting diag functions with diag lints) - #101236 (Avoid needless buffer zeroing in `std::sys::windows::fs`) - #101240 (Fix a typo on `wasm64-unknown-unknown` doc) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_data_structures/src')
| -rw-r--r-- | compiler/rustc_data_structures/src/sorted_map.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/compiler/rustc_data_structures/src/sorted_map.rs b/compiler/rustc_data_structures/src/sorted_map.rs index 9efea1228ab..937cb671573 100644 --- a/compiler/rustc_data_structures/src/sorted_map.rs +++ b/compiler/rustc_data_structures/src/sorted_map.rs @@ -164,7 +164,7 @@ impl<K: Ord, V> SortedMap<K, V> { /// It is up to the caller to make sure that the elements are sorted by key /// and that there are no duplicates. #[inline] - pub fn insert_presorted(&mut self, mut elements: Vec<(K, V)>) { + pub fn insert_presorted(&mut self, elements: Vec<(K, V)>) { if elements.is_empty() { return; } @@ -173,28 +173,28 @@ impl<K: Ord, V> SortedMap<K, V> { let start_index = self.lookup_index_for(&elements[0].0); - let drain = match start_index { + let elements = match start_index { Ok(index) => { - let mut drain = elements.drain(..); - self.data[index] = drain.next().unwrap(); - drain + let mut elements = elements.into_iter(); + self.data[index] = elements.next().unwrap(); + elements } Err(index) => { if index == self.data.len() || elements.last().unwrap().0 < self.data[index].0 { // We can copy the whole range without having to mix with // existing elements. - self.data.splice(index..index, elements.drain(..)); + self.data.splice(index..index, elements.into_iter()); return; } - let mut drain = elements.drain(..); - self.data.insert(index, drain.next().unwrap()); - drain + let mut elements = elements.into_iter(); + self.data.insert(index, elements.next().unwrap()); + elements } }; // Insert the rest - for (k, v) in drain { + for (k, v) in elements { self.insert(k, v); } } |
