lint: port explicit outlives diagnostics
Signed-off-by: David Wood <david.wood@huawei.com>
This commit is contained in:
parent
10676418fa
commit
acea23e796
2 changed files with 9 additions and 6 deletions
|
@ -376,3 +376,9 @@ lint-builtin-unnameable-test-items = cannot test inner items
|
||||||
|
|
||||||
lint-builtin-keyword-idents = `{$kw}` is a keyword in the {$next} edition
|
lint-builtin-keyword-idents = `{$kw}` is a keyword in the {$next} edition
|
||||||
.suggestion = you can use a raw identifier to stay compatible
|
.suggestion = you can use a raw identifier to stay compatible
|
||||||
|
|
||||||
|
lint-builtin-explicit-outlives = outlives requirements can be inferred
|
||||||
|
.suggestion = remove {$count ->
|
||||||
|
[one] this bound
|
||||||
|
*[other] these bounds
|
||||||
|
}
|
||||||
|
|
|
@ -2288,13 +2288,10 @@ impl<'tcx> LateLintPass<'tcx> for ExplicitOutlivesRequirements {
|
||||||
|
|
||||||
if !lint_spans.is_empty() {
|
if !lint_spans.is_empty() {
|
||||||
cx.struct_span_lint(EXPLICIT_OUTLIVES_REQUIREMENTS, lint_spans.clone(), |lint| {
|
cx.struct_span_lint(EXPLICIT_OUTLIVES_REQUIREMENTS, lint_spans.clone(), |lint| {
|
||||||
lint.build("outlives requirements can be inferred")
|
lint.build(fluent::lint::builtin_explicit_outlives)
|
||||||
|
.set_arg("count", bound_count)
|
||||||
.multipart_suggestion(
|
.multipart_suggestion(
|
||||||
if bound_count == 1 {
|
fluent::lint::suggestion,
|
||||||
"remove this bound"
|
|
||||||
} else {
|
|
||||||
"remove these bounds"
|
|
||||||
},
|
|
||||||
lint_spans
|
lint_spans
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|span| (span, String::new()))
|
.map(|span| (span, String::new()))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue