Address comment

This commit is contained in:
hi-rustin 2021-06-02 23:10:55 +08:00
parent c180af8e30
commit 957e2effc3

View File

@ -828,10 +828,9 @@ impl Visitor<'tcx> for Checker<'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 {
path.segments.last().map(|s| s.ident.span)
} else {
None
let method_span = match path.segments {
[.., _, last] => Some(last.ident.span),
_ => None,
};
self.tcx.check_stability(def_id, Some(id), path.span, method_span)
}