File tree Expand file tree Collapse file tree 3 files changed +39
-0
lines changed Expand file tree Collapse file tree 3 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedTraitNames {
7373 && let Some ( snip) = snippet_opt ( cx, last_segment. ident . span )
7474 && self . msrv . meets ( cx, msrvs:: UNDERSCORE_IMPORTS )
7575 && !is_from_proc_macro ( cx, & last_segment. ident )
76+ && ( !last_segment. ident . span . from_expansion ( ) || ident. span . from_expansion ( ) )
7677 {
7778 let complete_span = last_segment. ident . span . to ( ident. span ) ;
7879 span_lint_and_sugg (
Original file line number Diff line number Diff line change @@ -294,3 +294,22 @@ mod allow_lint_import {
294294// "foo".type_id();
295295// }
296296// }
297+
298+ mod issue14924 {
299+ mod m {
300+ pub trait Tr {
301+ fn method(&self) {}
302+ }
303+
304+ impl Tr for u8 {}
305+ }
306+
307+ macro gen_import($Br: ident) {
308+ use m::Tr as $Br;
309+ }
310+ gen_import!(Br);
311+
312+ fn do_something() {
313+ 0u8.method();
314+ }
315+ }
Original file line number Diff line number Diff line change @@ -294,3 +294,22 @@ mod allow_lint_import {
294294// "foo".type_id();
295295// }
296296// }
297+
298+ mod issue14924 {
299+ mod m {
300+ pub trait Tr {
301+ fn method ( & self ) { }
302+ }
303+
304+ impl Tr for u8 { }
305+ }
306+
307+ macro gen_import( $Br: ident) {
308+ use m:: Tr as $Br;
309+ }
310+ gen_import ! ( Br ) ;
311+
312+ fn do_something ( ) {
313+ 0u8 . method ( ) ;
314+ }
315+ }
You can’t perform that action at this time.
0 commit comments