Skip to content

Commit 18a48c1

Browse files
committed
lint: port anonymous parameter diagnostics
Signed-off-by: David Wood <david.wood@huawei.com>
1 parent 284ec37 commit 18a48c1

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

compiler/rustc_error_messages/locales/en-US/lint.ftl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,3 +331,6 @@ lint-builtin-missing-copy-impl = type could implement `Copy`; consider adding `i
331331
332332
lint-builtin-missing-debug-impl =
333333
type does not implement `{$debug}`; consider adding `#[derive(Debug)]` or a manual implementation
334+
335+
lint-builtin-anonymous-params = anonymous parameters are deprecated and will be removed in the next edition
336+
.suggestion = try naming the parameter or explicitly ignoring it

compiler/rustc_lint/src/builtin.rs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -937,18 +937,14 @@ impl EarlyLintPass for AnonymousParameters {
937937
("<type>", Applicability::HasPlaceholders)
938938
};
939939

940-
lint.build(
941-
"anonymous parameters are deprecated and will be \
942-
removed in the next edition",
943-
)
944-
.span_suggestion(
945-
arg.pat.span,
946-
"try naming the parameter or explicitly \
947-
ignoring it",
948-
format!("_: {}", ty_snip),
949-
appl,
950-
)
951-
.emit();
940+
lint.build(fluent::lint::builtin_anonymous_params)
941+
.span_suggestion(
942+
arg.pat.span,
943+
fluent::lint::suggestion,
944+
format!("_: {}", ty_snip),
945+
appl,
946+
)
947+
.emit();
952948
})
953949
}
954950
}

0 commit comments

Comments
 (0)