diff options
| author | Maybe Waffle <waffle.lapkin@gmail.com> | 2023-02-15 11:43:41 +0000 |
|---|---|---|
| committer | Maybe Waffle <waffle.lapkin@gmail.com> | 2023-02-16 15:26:00 +0000 |
| commit | 8751fa1a9abda9fc7ced6b03315efbd82310830d (patch) | |
| tree | f15613d5ca2fa5aadfdde2df1d94907d1798a5bb /compiler/rustc_parse/src/parser/path.rs | |
| parent | af3c8b27266e290cf65704284f6862d0f90ee4fc (diff) | |
| download | rust-8751fa1a9abda9fc7ced6b03315efbd82310830d.tar.gz rust-8751fa1a9abda9fc7ced6b03315efbd82310830d.zip | |
`if $c:expr { Some($r:expr) } else { None }` =>> `$c.then(|| $r)`
Diffstat (limited to 'compiler/rustc_parse/src/parser/path.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/path.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/path.rs b/compiler/rustc_parse/src/parser/path.rs index 2e706a00cf7..49959a8981c 100644 --- a/compiler/rustc_parse/src/parser/path.rs +++ b/compiler/rustc_parse/src/parser/path.rs @@ -404,7 +404,7 @@ impl<'a> Parser<'a> { let is_first_invocation = style == PathStyle::Expr; // Take a snapshot before attempting to parse - we can restore this later. - let snapshot = if is_first_invocation { Some(self.clone()) } else { None }; + let snapshot = is_first_invocation.then(|| self.clone()); debug!("parse_generic_args_with_leading_angle_bracket_recovery: (snapshotting)"); match self.parse_angle_args(ty_generics) { |
