Sitelet https://github.com/dtolnay/syn/commit/524db62194e184ee87b75e12e91e788912a6d984
Skip to content

Commit 524db62

Browse files
committed
Resolve collapsible_if clippy lint in lazy-static
warning: this `if` statement can be collapsed --> examples/lazy-static/lazy-static/src/lib.rs:78:5 | 78 | / if let Expr::Tuple(init) = &init { 79 | | if init.elems.is_empty() { 80 | | init.span() 81 | | .unwrap() ... | 86 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if = note: `-W clippy::collapsible-if` implied by `-W clippy::all` = help: to override `-W clippy::all` add `#[allow(clippy::collapsible_if)]` help: collapse nested if block | 78 ~ if let Expr::Tuple(init) = &init 79 ~ && init.elems.is_empty() { 80 | init.span() ... 84 | return TokenStream::new(); 85 ~ } |
1 parent 7e3a038 commit 524db62

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

  • examples/lazy-static/lazy-static/src

‎examples/lazy-static/lazy-static/src/lib.rs‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,14 @@ pub fn lazy_static(input: TokenStream) -> TokenStream {
7575
// |
7676
// 10 | static ref UNIT: () = ();
7777
// | ^^
78-
if let Expr::Tuple(init) = &init {
79-
if init.elems.is_empty() {
80-
init.span()
81-
.unwrap()
82-
.error("I can't think of a legitimate use for lazily initializing the value `()`")
83-
.emit();
84-
return TokenStream::new();
85-
}
78+
if let Expr::Tuple(init) = &init
79+
&& init.elems.is_empty()
80+
{
81+
init.span()
82+
.unwrap()
83+
.error("I can't think of a legitimate use for lazily initializing the value `()`")
84+
.emit();
85+
return TokenStream::new();
8686
}
8787

8888
// Assert that the static type implements Sync. If not, user sees an error

0 commit comments

Comments
 (0)