Skip to content

Commit

Permalink
Fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
liuchengxu committed Jun 20, 2024
1 parent 1cac8ef commit c1bceb2
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions crates/utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,6 @@ pub fn char_index_for(line: &str, byte_idx: usize) -> Option<usize> {

/// Returns the char at given byte index (0-based) in a line.
pub fn char_at(line: &str, byte_idx: usize) -> Option<char> {
line.char_indices().enumerate().find_map(
|(_c_idx, (b_idx, c))| {
if byte_idx == b_idx {
Some(c)
} else {
None
}
},
)
line.char_indices()
.find_map(|(b_idx, c)| if byte_idx == b_idx { Some(c) } else { None })
}

0 comments on commit c1bceb2

Please sign in to comment.