lint: port trivial bounds diagnostics

Signed-off-by: David Wood <david.wood@huawei.com>
This commit is contained in:
David Wood 2022-06-28 14:09:25 +01:00
parent 01a64af4dd
commit 3c9bda5b20
2 changed files with 6 additions and 6 deletions

View File

@ -366,3 +366,5 @@ lint-builtin-type-alias-where-clause = where clauses are not enforced in type al
lint-builtin-type-alias-generic-bounds = bounds on generic parameters are not enforced in type aliases
.suggestion = the bound will not be checked when the type alias is used, and should be removed
lint-builtin-trivial-bounds = {$predicate_kind_name} bound {$predicate} does not depend on any type or lifetime parameters

View File

@ -1671,12 +1671,10 @@ impl<'tcx> LateLintPass<'tcx> for TrivialConstraints {
};
if predicate.is_global() {
cx.struct_span_lint(TRIVIAL_BOUNDS, span, |lint| {
lint.build(&format!(
"{} bound {} does not depend on any type \
or lifetime parameters",
predicate_kind_name, predicate
))
.emit();
lint.build(fluent::lint::builtin_trivial_bounds)
.set_arg("predicate_kind_name", predicate_kind_name)
.set_arg("predicate", predicate)
.emit();
});
}
}