From 8584223d1bd7577d0607c5b4683163b0f0909e58 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 9 Aug 2024 23:37:01 -0700 Subject: [PATCH] Resolve single_match_else pedantic clippy lint warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` --> src/path.rs:175:21 | 175 | let qself = match qself { | _____________________^ 176 | | Some(qself) => qself, 177 | | None => { 178 | | self.path(path, kind); 179 | | return; 180 | | } 181 | | }; | |_________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match_else = note: `-W clippy::single-match-else` implied by `-W clippy::pedantic` = help: to override `-W clippy::pedantic` add `#[allow(clippy::single_match_else)]` help: try | 175 ~ let qself = if let Some(qself) = qself { qself } else { 176 + self.path(path, kind); 177 + return; 178 ~ }; | --- src/path.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/path.rs b/src/path.rs index abe5d48..2ae94b3 100644 --- a/src/path.rs +++ b/src/path.rs @@ -172,12 +172,11 @@ impl Printer { } pub fn qpath(&mut self, qself: &Option, path: &Path, kind: PathKind) { - let qself = match qself { - Some(qself) => qself, - None => { - self.path(path, kind); - return; - } + let qself = if let Some(qself) = qself { + qself + } else { + self.path(path, kind); + return; }; assert!(qself.position < path.segments.len());