Clean up clippy.

This commit is contained in:
Stephen Chung
2022-07-27 16:04:24 +08:00
parent 21f822020f
commit 39dee556c4
36 changed files with 271 additions and 369 deletions

View File

@@ -980,8 +980,8 @@ impl Engine {
})?,
offset,
)
} else if let Some(abs_index) = index.checked_abs() {
let offset = abs_index as usize;
} else {
let offset = index.unsigned_abs() as usize;
(
// Count from end if negative
s.chars().rev().nth(offset - 1).ok_or_else(|| {
@@ -990,9 +990,6 @@ impl Engine {
})?,
offset,
)
} else {
let chars_len = s.chars().count();
return Err(ERR::ErrorStringBounds(chars_len, index, idx_pos).into());
};
Ok(Target::StringChar {