middle: translation in LintDiagnosticBuilder
Accept `DiagnosticMessage` in `LintDiagnosticBuilder::build` so that lints can be built with translatable diagnostic messages. Signed-off-by: David Wood <david.wood@huawei.com>
This commit is contained in:
parent
a9eb9c52f3
commit
7d2eba6311
5 changed files with 8 additions and 7 deletions
|
@ -521,7 +521,7 @@ impl<'s> LintLevelsBuilder<'s> {
|
|||
src,
|
||||
Some(sp.into()),
|
||||
|lint| {
|
||||
let mut err = lint.build(&msg);
|
||||
let mut err = lint.build(msg);
|
||||
if let Some(new_name) = &renamed {
|
||||
err.span_suggestion(
|
||||
sp,
|
||||
|
@ -548,7 +548,7 @@ impl<'s> LintLevelsBuilder<'s> {
|
|||
} else {
|
||||
name.to_string()
|
||||
};
|
||||
let mut db = lint.build(&format!("unknown lint: `{}`", name));
|
||||
let mut db = lint.build(format!("unknown lint: `{}`", name));
|
||||
if let Some(suggestion) = suggestion {
|
||||
db.span_suggestion(
|
||||
sp,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue