Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit 5f2305a

Browse files
committed
Reduce clones in crate input file calculation
1 parent db1f1ed commit 5f2305a

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

rls/src/build/rustc.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,10 @@ impl rustc_driver::Callbacks for RlsRustcCalls {
188188
RustcEdition::Edition2018 => Edition::Edition2018,
189189
},
190190
};
191-
let files = fetch_input_files(sess);
192191

193192
let mut input_files = self.input_files.lock().unwrap();
194-
for file in &files {
195-
input_files.entry(file.to_path_buf()).or_default().insert(krate.clone());
193+
for file in fetch_input_files(sess) {
194+
input_files.entry(file).or_default().insert(krate.clone());
196195
}
197196

198197
// Guaranteed to not be dropped yet in the pipeline thanks to the
@@ -285,7 +284,6 @@ fn fetch_input_files(sess: &Session) -> Vec<PathBuf> {
285284
.filter(|fmap| !fmap.is_imported())
286285
.map(|fmap| fmap.name.to_string())
287286
.map(|fmap| src_path(Some(cwd), fmap).unwrap())
288-
.map(PathBuf::from)
289287
.collect()
290288
}
291289

0 commit comments

Comments
 (0)