diff options
| author | Tyson Nottingham <tgnottingham@gmail.com> | 2020-09-20 17:40:37 -0700 |
|---|---|---|
| committer | Tyson Nottingham <tgnottingham@gmail.com> | 2020-12-03 18:36:34 -0800 |
| commit | 8da2a5a27c9890100e3b56ec85879e312312b111 (patch) | |
| tree | c9052617c6d1afd80b7cc3dfae98988c55df1f18 | |
| parent | 5be3f9f10e9fd59ea03816840a6051413fbdefae (diff) | |
| download | rust-8da2a5a27c9890100e3b56ec85879e312312b111.tar.gz rust-8da2a5a27c9890100e3b56ec85879e312312b111.zip | |
rustc_span: avoid unnecessary cloning in byte_pos_to_line_and_col
| -rw-r--r-- | compiler/rustc_span/src/caching_source_map_view.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_span/src/caching_source_map_view.rs b/compiler/rustc_span/src/caching_source_map_view.rs index 15dd00fb483..9360d5b5abf 100644 --- a/compiler/rustc_span/src/caching_source_map_view.rs +++ b/compiler/rustc_span/src/caching_source_map_view.rs @@ -84,10 +84,10 @@ impl<'sm> CachingSourceMapView<'sm> { let file_valid; if self.source_map.files().len() > 0 { let file_index = self.source_map.lookup_source_file_idx(pos); - let file = self.source_map.files()[file_index].clone(); + let file = &self.source_map.files()[file_index]; if file_contains(&file, pos) { - cache_entry.file = file; + cache_entry.file = file.clone(); cache_entry.file_index = file_index; file_valid = true; } else { |
