Skip to content

Commit b6d90c4

Browse files
committed
Skip unused_parens report for Paren(Path(..)) in macro.
fixes rust-lang#120642
1 parent 66de611 commit b6d90c4

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

compiler/rustc_lint/src/unused.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1232,6 +1232,7 @@ impl EarlyLintPass for UnusedParens {
12321232
ast::TyKind::BareFn(b)
12331233
if self.with_self_ty_parens && b.generic_params.len() > 0 => {}
12341234
ast::TyKind::ImplTrait(_, bounds) if bounds.len() > 1 => {}
1235+
ast::TyKind::Path(_, _) if ty.span.from_expansion() => {}
12351236
_ => {
12361237
let spans = r
12371238
.span
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//@ check-pass
2+
#![warn(unused_parens)]
3+
#![deny(warnings)]
4+
5+
trait Foo {
6+
fn bar();
7+
}
8+
9+
macro_rules! problem {
10+
($ty:ident) => {
11+
impl<$ty: Foo> Foo for ($ty,) {
12+
fn bar() { <$ty>::bar() }
13+
}
14+
};
15+
($ty:ident $(, $rest:ident)*) => {
16+
impl<$ty: Foo, $($rest: Foo),*> Foo for ($ty, $($rest),*) {
17+
fn bar() {
18+
<$ty>::bar();
19+
<($($rest),*)>::bar()
20+
}
21+
}
22+
23+
problem!($($rest),*);
24+
}
25+
}
26+
27+
fn main() {
28+
problem!(T1, T2, T3);
29+
}

0 commit comments

Comments
 (0)