Skip to content

Commit

Permalink
Resolve get_first clippy lint
Browse files Browse the repository at this point in the history
    error: accessing first element with `slice.as_bytes().get(0)`
       --> src/error.rs:441:11
        |
    441 |     match slice.as_bytes().get(0) {
        |           ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `slice.as_bytes().first()`
        |
        = note: `-D clippy::get-first` implied by `-D clippy::all`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first
  • Loading branch information
dtolnay committed Jun 7, 2022
1 parent 6b91c96 commit de5c34b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/error.rs
Expand Up @@ -438,7 +438,7 @@ fn parse_line_col(msg: &mut String) -> Option<(usize, usize)> {
}

fn starts_with_digit(slice: &str) -> bool {
match slice.as_bytes().get(0) {
match slice.as_bytes().first() {
None => false,
Some(&byte) => byte >= b'0' && byte <= b'9',
}
Expand Down

0 comments on commit de5c34b

Please sign in to comment.