From 947a09a4a88f97aa0ab59a5d21afd8ca3d429e60 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Tue, 18 Jan 2022 19:18:47 -0800 Subject: [PATCH] Replace `if` + `unwrap` with `if let` in check_stack --- compiler/rustc_ast_pretty/src/pp.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/compiler/rustc_ast_pretty/src/pp.rs b/compiler/rustc_ast_pretty/src/pp.rs index 8d58eaa82a7..b2870ac2734 100644 --- a/compiler/rustc_ast_pretty/src/pp.rs +++ b/compiler/rustc_ast_pretty/src/pp.rs @@ -379,8 +379,7 @@ impl Printer { } fn check_stack(&mut self, k: usize) { - if !self.scan_stack.is_empty() { - let x = *self.scan_stack.front().unwrap(); + if let Some(&x) = self.scan_stack.front() { match self.buf[x].token { Token::Begin(_) => { if k > 0 {