about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDániel Buga <bugadani@gmail.com>2020-10-28 17:05:49 +0100
committerDániel Buga <bugadani@gmail.com>2020-10-28 17:22:10 +0100
commit2fa359814aab054f4b0c9c764a6d6a36ecf6cde8 (patch)
tree2885fb88235eefacffb75bd3c183208a3c551dae
parent5248b20d9ae02a39cb20448896fc663636f591fc (diff)
downloadrust-2fa359814aab054f4b0c9c764a6d6a36ecf6cde8.tar.gz
rust-2fa359814aab054f4b0c9c764a6d6a36ecf6cde8.zip
Avoid reallocating cgu_path_components
-rw-r--r--compiler/rustc_incremental/src/assert_module_sources.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/rustc_incremental/src/assert_module_sources.rs b/compiler/rustc_incremental/src/assert_module_sources.rs
index 80448c01a26..17d8ac9c882 100644
--- a/compiler/rustc_incremental/src/assert_module_sources.rs
+++ b/compiler/rustc_incremental/src/assert_module_sources.rs
@@ -111,10 +111,12 @@ impl AssertModuleSource<'tcx> {
             (&user_path[..], None)
         };
 
-        let mut cgu_path_components = user_path.split('-').collect::<Vec<_>>();
+        let mut iter = user_path.split('-');
 
         // Remove the crate name
-        assert_eq!(cgu_path_components.remove(0), crate_name);
+        assert_eq!(iter.next().unwrap(), crate_name);
+
+        let cgu_path_components = iter.collect::<Vec<_>>();
 
         let cgu_name_builder = &mut CodegenUnitNameBuilder::new(self.tcx);
         let cgu_name =