errors: span_suggestion takes impl ToString

Change `span_suggestion` (and variants) to take `impl ToString` rather
than `String` for the suggested code, as this simplifies the
requirements on the diagnostic derive.

Signed-off-by: David Wood <david.wood@huawei.com>
This commit is contained in:
David Wood 2022-04-26 06:17:33 +01:00
parent ec3afba5d4
commit 5ffe8a1a90
2 changed files with 3 additions and 3 deletions

View File

@ -108,7 +108,7 @@ fn check_needless_must_use(
diag.span_suggestion(
attr.span,
"remove the attribute",
"".into(),
"",
Applicability::MachineApplicable,
);
},

View File

@ -241,7 +241,7 @@ fn check_fn(
|x| Cow::from(format!("change `{}` to", x)),
)
.as_ref(),
suggestion.into(),
suggestion,
Applicability::Unspecified,
);
}
@ -271,7 +271,7 @@ fn check_fn(
|x| Cow::from(format!("change `{}` to", x))
)
.as_ref(),
suggestion.into(),
suggestion,
Applicability::Unspecified,
);
}