Skip to content

Commit 8da2a5a

Browse files
committed
rustc_span: avoid unnecessary cloning in byte_pos_to_line_and_col
1 parent 5be3f9f commit 8da2a5a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler/rustc_span/src/caching_source_map_view.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ impl<'sm> CachingSourceMapView<'sm> {
8484
let file_valid;
8585
if self.source_map.files().len() > 0 {
8686
let file_index = self.source_map.lookup_source_file_idx(pos);
87-
let file = self.source_map.files()[file_index].clone();
87+
let file = &self.source_map.files()[file_index];
8888

8989
if file_contains(&file, pos) {
90-
cache_entry.file = file;
90+
cache_entry.file = file.clone();
9191
cache_entry.file_index = file_index;
9292
file_valid = true;
9393
} else {

0 commit comments

Comments
 (0)