diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-12-15 12:46:04 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-15 12:46:04 +0100 |
| commit | c0862f30bd0fa60370709a2f6e7eb4238aaf53fa (patch) | |
| tree | 6c764153bd4a3160a9a5c4ef11eb3707258d61ff /compiler/rustc_span/src | |
| parent | cb9bcafe0d5128d6381a836f7640c4de74ad64b3 (diff) | |
| parent | de59844c98f7925242a798a72c59dc3610dd0e2c (diff) | |
| download | rust-c0862f30bd0fa60370709a2f6e7eb4238aaf53fa.tar.gz rust-c0862f30bd0fa60370709a2f6e7eb4238aaf53fa.zip | |
Rollup merge of #105722 - matthiaskrgr:compl2, r=compiler-errors
more clippy::complexity fixes r? ```@compiler-errors```
Diffstat (limited to 'compiler/rustc_span/src')
| -rw-r--r-- | compiler/rustc_span/src/analyze_source_file.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_span/src/lib.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_span/src/source_map.rs | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_span/src/analyze_source_file.rs b/compiler/rustc_span/src/analyze_source_file.rs index d3c2c5113bc..26cd54210d0 100644 --- a/compiler/rustc_span/src/analyze_source_file.rs +++ b/compiler/rustc_span/src/analyze_source_file.rs @@ -175,7 +175,7 @@ cfg_if::cfg_if! { // There might still be a tail left to analyze let tail_start = chunk_count * CHUNK_SIZE + intra_chunk_offset; if tail_start < src.len() { - analyze_source_file_generic(&src[tail_start as usize ..], + analyze_source_file_generic(&src[tail_start ..], src.len() - tail_start, output_offset + BytePos::from_usize(tail_start), lines, @@ -219,7 +219,7 @@ fn analyze_source_file_generic( while i < scan_len { let byte = unsafe { // We verified that i < scan_len <= src.len() - *src_bytes.get_unchecked(i as usize) + *src_bytes.get_unchecked(i) }; // How much to advance in order to get to the next UTF-8 char in the diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs index 335bfc3302f..5525eb5331c 100644 --- a/compiler/rustc_span/src/lib.rs +++ b/compiler/rustc_span/src/lib.rs @@ -1381,7 +1381,7 @@ impl<S: Encoder> Encodable<S> for SourceFile { 4 => { raw_diffs = Vec::with_capacity(bytes_per_diff * num_diffs); for diff in diff_iter { - raw_diffs.extend_from_slice(&(diff.0 as u32).to_le_bytes()); + raw_diffs.extend_from_slice(&(diff.0).to_le_bytes()); } } _ => unreachable!(), diff --git a/compiler/rustc_span/src/source_map.rs b/compiler/rustc_span/src/source_map.rs index a4e0f54d276..fb3e4a6c083 100644 --- a/compiler/rustc_span/src/source_map.rs +++ b/compiler/rustc_span/src/source_map.rs @@ -941,7 +941,7 @@ impl SourceMap { /// Otherwise, the span reached to limit is returned. pub fn span_look_ahead(&self, span: Span, expect: Option<&str>, limit: Option<usize>) -> Span { let mut sp = span; - for _ in 0..limit.unwrap_or(100 as usize) { + for _ in 0..limit.unwrap_or(100_usize) { sp = self.next_point(sp); if let Ok(ref snippet) = self.span_to_snippet(sp) { if expect.map_or(false, |es| snippet == es) { |
