Skip to content

Commit 957e2ef

Browse files
committed
Address comment
1 parent c180af8 commit 957e2ef

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

compiler/rustc_passes/src/stability.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -828,10 +828,9 @@ impl Visitor<'tcx> for Checker<'tcx> {
828828

829829
fn visit_path(&mut self, path: &'tcx hir::Path<'tcx>, id: hir::HirId) {
830830
if let Some(def_id) = path.res.opt_def_id() {
831-
let method_span = if path.segments.len() >= 2 {
832-
path.segments.last().map(|s| s.ident.span)
833-
} else {
834-
None
831+
let method_span = match path.segments {
832+
[.., _, last] => Some(last.ident.span),
833+
_ => None,
835834
};
836835
self.tcx.check_stability(def_id, Some(id), path.span, method_span)
837836
}

0 commit comments

Comments
 (0)