Skip to content

Commit 39ac89e

Browse files
committed
Resolve manual_let_else pedantic clippy lint
warning: this could be rewritten as `let...else` --> build.rs:8:5 | 8 | / let minor = match rustc_minor_version() { 9 | | Some(minor) => minor, 10 | | None => return, 11 | | }; | |______^ help: consider writing: `let Some(minor) = rustc_minor_version() else { return };` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else = note: `-W clippy::manual-let-else` implied by `-W clippy::pedantic` = help: to override `-W clippy::pedantic` add `#[allow(clippy::manual_let_else)]` warning: this could be rewritten as `let...else` --> src/spanned.rs:31:5 | 31 | / let first = match iter.next() { 32 | | Some(span) => span, 33 | | None => return Span::call_site(), 34 | | }; | |______^ help: consider writing: `let Some(first) = iter.next() else { return Span::call_site() };` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else = note: `-W clippy::manual-let-else` implied by `-W clippy::pedantic` = help: to override `-W clippy::pedantic` add `#[allow(clippy::manual_let_else)]`
1 parent f3eac36 commit 39ac89e

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

build.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ use std::str;
55
fn main() {
66
println!("cargo:rerun-if-changed=build.rs");
77

8-
let minor = match rustc_minor_version() {
9-
Some(minor) => minor,
10-
None => return,
8+
let Some(minor) = rustc_minor_version() else {
9+
return;
1110
};
1211

1312
if minor >= 77 {

src/spanned.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@ impl<T: ?Sized + ToTokens> Spanned for T {
2828
fn join_spans(tokens: TokenStream) -> Span {
2929
let mut iter = tokens.into_iter().map(|tt| tt.span());
3030

31-
let first = match iter.next() {
32-
Some(span) => span,
33-
None => return Span::call_site(),
31+
let Some(first) = iter.next() else {
32+
return Span::call_site();
3433
};
3534

3635
iter.fold(None, |_prev, next| Some(next))

0 commit comments

Comments
 (0)