Skip to content

Commit c9dc2b5

Browse files
committed
Fix ICE in use_self lint
1 parent 2d6adb9 commit c9dc2b5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

clippy_lints/src/use_self.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use rustc::{declare_lint_pass, declare_tool_lint};
1010
use rustc_errors::Applicability;
1111
use syntax_pos::symbol::kw;
1212

13-
use crate::utils::span_lint_and_sugg;
13+
use crate::utils::{differing_macro_contexts, span_lint_and_sugg};
1414

1515
declare_clippy_lint! {
1616
/// **What it does:** Checks for unnecessary repetition of structure name when a
@@ -56,6 +56,11 @@ fn span_use_self_lint(cx: &LateContext<'_, '_>, path: &Path, last_segment: Optio
5656

5757
// Path segments only include actual path, no methods or fields.
5858
let last_path_span = last_segment.ident.span;
59+
60+
if differing_macro_contexts(path.span, last_path_span) {
61+
return;
62+
}
63+
5964
// Only take path up to the end of last_path_span.
6065
let span = path.span.with_hi(last_path_span.hi());
6166

0 commit comments

Comments
 (0)