1
Fork 0

Fix uninlined_format_args for some compiler crates

Convert all the crates that have had their diagnostic migration
completed (except save_analysis because that will be deleted soon and
apfloat because of the licensing problem).
This commit is contained in:
nils 2022-12-19 10:31:55 +01:00 committed by Nilstrieb
parent 1d284af117
commit fd7a159710
91 changed files with 287 additions and 329 deletions

View file

@ -76,11 +76,11 @@ pub(crate) fn invalid_attr(attr: &Attribute, meta: &Meta) -> Diagnostic {
let span = attr.span().unwrap();
let path = path_to_string(&attr.path);
match meta {
Meta::Path(_) => span_err(span, &format!("`#[{}]` is not a valid attribute", path)),
Meta::Path(_) => span_err(span, &format!("`#[{path}]` is not a valid attribute")),
Meta::NameValue(_) => {
span_err(span, &format!("`#[{} = ...]` is not a valid attribute", path))
span_err(span, &format!("`#[{path} = ...]` is not a valid attribute"))
}
Meta::List(_) => span_err(span, &format!("`#[{}(...)]` is not a valid attribute", path)),
Meta::List(_) => span_err(span, &format!("`#[{path}(...)]` is not a valid attribute")),
}
}
@ -107,7 +107,7 @@ pub(crate) fn invalid_nested_attr(attr: &Attribute, nested: &NestedMeta) -> Diag
let meta = match nested {
syn::NestedMeta::Meta(meta) => meta,
syn::NestedMeta::Lit(_) => {
return span_err(span, &format!("`#[{}(\"...\")]` is not a valid attribute", name));
return span_err(span, &format!("`#[{name}(\"...\")]` is not a valid attribute"));
}
};
@ -115,13 +115,11 @@ pub(crate) fn invalid_nested_attr(attr: &Attribute, nested: &NestedMeta) -> Diag
let path = path_to_string(meta.path());
match meta {
Meta::NameValue(..) => {
span_err(span, &format!("`#[{}({} = ...)]` is not a valid attribute", name, path))
}
Meta::Path(..) => {
span_err(span, &format!("`#[{}({})]` is not a valid attribute", name, path))
span_err(span, &format!("`#[{name}({path} = ...)]` is not a valid attribute"))
}
Meta::Path(..) => span_err(span, &format!("`#[{name}({path})]` is not a valid attribute")),
Meta::List(..) => {
span_err(span, &format!("`#[{}({}(...))]` is not a valid attribute", name, path))
span_err(span, &format!("`#[{name}({path}(...))]` is not a valid attribute"))
}
}
}

View file

@ -178,7 +178,7 @@ pub(crate) fn fluent_messages(input: proc_macro::TokenStream) -> proc_macro::Tok
opt: Default::default(),
};
let dl = DisplayList::from(snippet);
eprintln!("{}\n", dl);
eprintln!("{dl}\n");
}
continue;
}
@ -265,7 +265,7 @@ pub(crate) fn fluent_messages(input: proc_macro::TokenStream) -> proc_macro::Tok
Diagnostic::spanned(
path_span,
Level::Error,
format!("overrides existing {}: `{}`", kind, id),
format!("overrides existing {kind}: `{id}`"),
)
.span_help(previous_defns[&id], "previously defined in this resource")
.emit();

View file

@ -198,8 +198,7 @@ impl<'parent, 'a> SubdiagnosticDeriveVariantBuilder<'parent, 'a> {
throw_span_err!(
attr.span().unwrap(),
&format!(
"diagnostic slug must be first argument of a `#[{}(...)]` attribute",
name
"diagnostic slug must be first argument of a `#[{name}(...)]` attribute"
)
);
};

View file

@ -322,7 +322,7 @@ pub(crate) trait HasFieldMap {
None => {
span_err(
span.unwrap(),
&format!("`{}` doesn't refer to a field on this type", field),
&format!("`{field}` doesn't refer to a field on this type"),
)
.emit();
quote! {
@ -603,8 +603,7 @@ impl SubdiagnosticKind {
if suggestion_kind != SuggestionKind::Normal {
invalid_attr(attr, &meta)
.help(format!(
r#"Use `#[suggestion(..., style = "{}")]` instead"#,
suggestion_kind
r#"Use `#[suggestion(..., style = "{suggestion_kind}")]` instead"#
))
.emit();
}
@ -621,8 +620,7 @@ impl SubdiagnosticKind {
if suggestion_kind != SuggestionKind::Normal {
invalid_attr(attr, &meta)
.help(format!(
r#"Use `#[multipart_suggestion(..., style = "{}")]` instead"#,
suggestion_kind
r#"Use `#[multipart_suggestion(..., style = "{suggestion_kind}")]` instead"#
))
.emit();
}