Rollup merge of #57699 - euclio:applicability-ify, r=petrochenkov

add applicability to remaining suggestions

Fixes #50723.

I noticed that the suggestion methods on `DiagnosticBuilder` weren't actually deprecated due to #57679. This PR deprecates them properly and fixes the remaining usages.

There's also a PR for clippy at rust-lang/rust-clippy#3667.
This commit is contained in:
Mazdak Farrokhzad
2019-01-19 14:21:23 +01:00
committed by GitHub
5 changed files with 83 additions and 37 deletions

View File

@@ -4063,12 +4063,13 @@ impl<'a> Parser<'a> {
if let Some(mut err) = delayed_err {
if let Some(etc_span) = etc_span {
err.multipart_suggestion(
err.multipart_suggestion_with_applicability(
"move the `..` to the end of the field list",
vec![
(etc_span, String::new()),
(self.span, format!("{}.. }}", if ate_comma { "" } else { ", " })),
],
Applicability::MachineApplicable,
);
}
err.emit();
@@ -6904,7 +6905,11 @@ impl<'a> Parser<'a> {
let mut err = self.struct_span_err(fixed_name_sp, error_msg);
err.span_label(fixed_name_sp, "dash-separated idents are not valid");
err.multipart_suggestion(suggestion_msg, replacement);
err.multipart_suggestion_with_applicability(
suggestion_msg,
replacement,
Applicability::MachineApplicable,
);
err.emit();
}
Ok(ident)