Skip to content

Commit 77831d9

Browse files
authored
Add braces around "let with multiple patterns" case (#20)
This fixes the trailing semicolon warning: ``` warning: trailing semicolon in macro used in expression position --> src/lib.rs:297:37 | 297 | then { assert_eq!(x, 42); } | ^ | = note: `#[warn(semicolon_in_expressions_from_macros)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #79813 <rust-lang/rust#79813> ```
1 parent a68e948 commit 77831d9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ macro_rules! __if_chain {
193193
// `let` with multiple patterns
194194
(@expand { $($other:tt)* } let $pat1:pat | $($pat:pat)|+ = $expr:expr; $($tt:tt)+) => {
195195
match $expr {
196-
$pat1 | $($pat)|+ => __if_chain! { @expand { $($other)* } $($tt)+ }
196+
$pat1 | $($pat)|+ => { __if_chain! { @expand { $($other)* } $($tt)+ } }
197197
}
198198
};
199199
// `if let` with a single pattern
@@ -308,7 +308,7 @@ mod tests {
308308

309309
then { x += y; }
310310
else { x += 1; }
311-
};
311+
}
312312
assert_eq!(x, 3);
313313
}
314314
}

0 commit comments

Comments
 (0)