From aa74c75d849b63135c922c9c74324944af5bc487 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sun, 18 Jul 2021 00:01:59 +0200 Subject: [PATCH] clippy:: append_instead_of_extend --- compiler/rustc_mir/src/monomorphize/partitioning/merging.rs | 2 +- compiler/rustc_mir/src/transform/inline.rs | 4 ++-- compiler/rustc_traits/src/dropck_outlives.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_mir/src/monomorphize/partitioning/merging.rs b/compiler/rustc_mir/src/monomorphize/partitioning/merging.rs index 5107e697263..cbe36665790 100644 --- a/compiler/rustc_mir/src/monomorphize/partitioning/merging.rs +++ b/compiler/rustc_mir/src/monomorphize/partitioning/merging.rs @@ -46,7 +46,7 @@ pub fn merge_codegen_units<'tcx>( // Record that `second_smallest` now contains all the stuff that was in // `smallest` before. let mut consumed_cgu_names = cgu_contents.remove(&smallest.name()).unwrap(); - cgu_contents.get_mut(&second_smallest.name()).unwrap().extend(consumed_cgu_names.drain(..)); + cgu_contents.get_mut(&second_smallest.name()).unwrap().append(&mut consumed_cgu_names); debug!( "CodegenUnit {} merged into CodegenUnit {}", diff --git a/compiler/rustc_mir/src/transform/inline.rs b/compiler/rustc_mir/src/transform/inline.rs index 7d765cec575..8e6654cb2da 100644 --- a/compiler/rustc_mir/src/transform/inline.rs +++ b/compiler/rustc_mir/src/transform/inline.rs @@ -614,8 +614,8 @@ fn dest_needs_borrow(place: Place<'_>) -> bool { .vars_and_temps_iter() .map(|local| callee_body.local_decls[local].clone()), ); - caller_body.source_scopes.extend(callee_body.source_scopes.drain(..)); - caller_body.var_debug_info.extend(callee_body.var_debug_info.drain(..)); + caller_body.source_scopes.extend(&mut callee_body.source_scopes.drain(..)); + caller_body.var_debug_info.append(&mut callee_body.var_debug_info); caller_body.basic_blocks_mut().extend(callee_body.basic_blocks_mut().drain(..)); caller_body[callsite.block].terminator = Some(Terminator { diff --git a/compiler/rustc_traits/src/dropck_outlives.rs b/compiler/rustc_traits/src/dropck_outlives.rs index 4a41dfe0143..672e149b5fc 100644 --- a/compiler/rustc_traits/src/dropck_outlives.rs +++ b/compiler/rustc_traits/src/dropck_outlives.rs @@ -90,8 +90,8 @@ fn dropck_outlives<'tcx>( // "outlives" represent types/regions that may be touched // by a destructor. - result.kinds.extend(constraints.outlives.drain(..)); - result.overflows.extend(constraints.overflows.drain(..)); + result.kinds.append(&mut constraints.outlives); + result.overflows.append(&mut constraints.overflows); // If we have even one overflow, we should stop trying to evaluate further -- // chances are, the subsequent overflows for this evaluation won't provide useful