Skip to content

Commit a47ae57

Browse files
committed
Use an @ pattern to shorten some code.
1 parent 0ca92de commit a47ae57

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

compiler/rustc_parse/src/parser/attr_wrapper.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -325,12 +325,9 @@ impl<'a> Parser<'a> {
325325
replace_ranges,
326326
});
327327

328-
// If we support tokens at all
329-
if let Some(target_tokens) = ret.tokens_mut() {
330-
if target_tokens.is_none() {
331-
// Store our newly captured tokens into the AST node.
332-
*target_tokens = Some(tokens.clone());
333-
}
328+
// If we support tokens and don't already have them, store the newly captured tokens.
329+
if let Some(target_tokens @ None) = ret.tokens_mut() {
330+
*target_tokens = Some(tokens.clone());
334331
}
335332

336333
let final_attrs = ret.attrs();

0 commit comments

Comments
 (0)