more clippy::complexity fixes
This commit is contained in:
parent
fbf8b937b4
commit
de59844c98
13 changed files with 23 additions and 41 deletions
|
@ -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
|
||||
|
|
|
@ -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!(),
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue