redundant_field_names: Do not trigger on path with type params
Fixes #3476
This commit is contained in:
parent
28635ff04b
commit
eb54c1a9a0
@ -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,
|
||||
|
@ -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> };
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user