Skip to content

Commit 3b88948

Browse files
committed
use_self - improve span handling
1 parent 4547172 commit 3b88948

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clippy_lints/src/use_self.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,14 @@ impl<'a, 'tcx> Visitor<'tcx> for ImplVisitor<'a, 'tcx> {
167167
if hir_ty_to_ty(self.cx.tcx, hir_ty) == self.self_ty {
168168
match self.cx.tcx.hir().find(self.cx.tcx.hir().get_parent_node(hir_ty.hir_id)) {
169169
Some(Node::Expr(Expr {
170-
kind: ExprKind::Path(QPath::TypeRelative(_, last_segment)),
170+
kind: ExprKind::Path(QPath::TypeRelative(..)),
171171
..
172172
})) =>
173173
// FIXME: this span manipulation should not be necessary
174174
// @flip1995 found an ast lowering issue in
175175
// https://github.com/rust-lang/rust/blob/master/src/librustc_ast_lowering/path.rs#L142-L162
176176
{
177-
span_lint(self.cx, hir_ty.span.with_hi(last_segment.ident.span.lo() - BytePos(2)))
177+
span_lint(self.cx, truncate_last_segment(self.cx.tcx, hir_ty.span))
178178
},
179179
_ => span_lint(self.cx, hir_ty.span),
180180
}

0 commit comments

Comments
 (0)