]> git.lizzy.rs Git - rust.git/commitdiff
Address comment
authorhi-rustin <rustin.liu@gmail.com>
Mon, 24 May 2021 16:33:41 +0000 (00:33 +0800)
committerhi-rustin <rustin.liu@gmail.com>
Mon, 24 May 2021 16:33:41 +0000 (00:33 +0800)
compiler/rustc_passes/src/stability.rs

index 2a09311bbdb43797c1c175371c0ed40e068759d2..c6c165544a94d602a2c849a5dcec56447fd42780 100644 (file)
@@ -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
             };