Resolve let_and_return clippy lint

warning: returning the result of a `let` binding from a block
      --> impl/src/fmt.rs:67:21
       |
    63 | /                     let member = match int.parse::<u32>() {
    64 | |                         Ok(index) => MemberUnraw::Unnamed(Index { index, span }),
    65 | |                         Err(_) => return Ok(()),
    66 | |                     };
       | |______________________- unnecessary `let` binding
    67 |                       member
       |                       ^^^^^^
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
       = note: `-W clippy::let-and-return` implied by `-W clippy::all`
       = help: to override `-W clippy::all` add `#[allow(clippy::let_and_return)]`
    help: return the expression directly
       |
    63 ~
    64 ~                     match int.parse::<u32>() {
    65 +                         Ok(index) => MemberUnraw::Unnamed(Index { index, span }),
    66 +                         Err(_) => return Ok(()),
    67 +                     }
       |
This commit is contained in:
David Tolnay 2024-11-08 13:22:54 -05:00
parent 3ee0a4dfdb
commit fb59da6f7b
No known key found for this signature in database
GPG key ID: F9BA143B95FF6D82

View file

@ -60,11 +60,10 @@ impl Display<'_> {
return Err(Error::new_spanned(first_unnamed, msg));
}
}
let member = match int.parse::<u32>() {
match int.parse::<u32>() {
Ok(index) => MemberUnraw::Unnamed(Index { index, span }),
Err(_) => return Ok(()),
};
member
}
}
'a'..='z' | 'A'..='Z' | '_' => {
if read.starts_with("r#") {