Skip to content

Commit 2fa3598

Browse files
committed
Avoid reallocating cgu_path_components
1 parent 5248b20 commit 2fa3598

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

compiler/rustc_incremental/src/assert_module_sources.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,12 @@ impl AssertModuleSource<'tcx> {
111111
(&user_path[..], None)
112112
};
113113

114-
let mut cgu_path_components = user_path.split('-').collect::<Vec<_>>();
114+
let mut iter = user_path.split('-');
115115

116116
// Remove the crate name
117-
assert_eq!(cgu_path_components.remove(0), crate_name);
117+
assert_eq!(iter.next().unwrap(), crate_name);
118+
119+
let cgu_path_components = iter.collect::<Vec<_>>();
118120

119121
let cgu_name_builder = &mut CodegenUnitNameBuilder::new(self.tcx);
120122
let cgu_name =

0 commit comments

Comments
 (0)