From c180af8e30bc815118ac3efe633f7cf8870465da Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Tue, 25 May 2021 00:33:41 +0800 Subject: [PATCH] Address comment --- compiler/rustc_passes/src/stability.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs index 2a09311bbdb..c6c165544a9 100644 --- a/compiler/rustc_passes/src/stability.rs +++ b/compiler/rustc_passes/src/stability.rs @@ -829,10 +829,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) { fn visit_path(&mut self, path: &'tcx hir::Path<'tcx>, id: hir::HirId) { if let Some(def_id) = path.res.opt_def_id() { let method_span = if path.segments.len() >= 2 { - match path.segments.last() { - Some(s) => Some(s.ident.span), - None => None, - } + path.segments.last().map(|s| s.ident.span) } else { None }; -- 2.44.0