From: hi-rustin Date: Mon, 24 May 2021 16:33:41 +0000 (+0800) Subject: Address comment X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=c180af8e30bc815118ac3efe633f7cf8870465da;p=rust.git Address comment --- 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 };