redundant_field_names: Do not trigger on path with type params

Fixes #3476
This commit is contained in:
Shotaro Yamada 2018-12-11 23:33:23 +09:00 committed by Shotaro Yamada
parent 28635ff04b
commit eb54c1a9a0
2 changed files with 15 additions and 1 deletions

View File

@ -57,7 +57,10 @@ impl EarlyLintPass for RedundantFieldNames {
continue;
}
if let ExprKind::Path(None, path) = &field.expr.node {
if path.segments.len() == 1 && path.segments[0].ident == field.ident {
if path.segments.len() == 1
&& path.segments[0].ident == field.ident
&& path.segments[0].args.is_none()
{
span_lint_and_sugg(
cx,
REDUNDANT_FIELD_NAMES,

View File

@ -68,3 +68,14 @@ fn main() {
let _ = RangeInclusive::new(start, end);
let _ = RangeToInclusive { end: end };
}
fn issue_3476() {
fn foo<T>() {
}
struct S {
foo: fn(),
}
S { foo: foo::<i32> };
}