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:
parent
1d284af117
commit
fd7a159710
91 changed files with 287 additions and 329 deletions
|
@ -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"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
);
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ impl Parse for Newtype {
|
|||
};
|
||||
|
||||
if let Some(old) = max.replace(literal.lit) {
|
||||
panic!("Specified multiple max: {:?}", old);
|
||||
panic!("Specified multiple max: {old:?}");
|
||||
}
|
||||
|
||||
false
|
||||
|
@ -52,7 +52,7 @@ impl Parse for Newtype {
|
|||
};
|
||||
|
||||
if let Some(old) = debug_format.replace(literal.lit) {
|
||||
panic!("Specified multiple debug format options: {:?}", old);
|
||||
panic!("Specified multiple debug format options: {old:?}");
|
||||
}
|
||||
|
||||
false
|
||||
|
|
|
@ -239,7 +239,7 @@ fn doc_comment_from_desc(list: &Punctuated<Expr, token::Comma>) -> Result<Attrib
|
|||
.unwrap();
|
||||
},
|
||||
);
|
||||
let doc_string = format!("[query description - consider adding a doc-comment!] {}", doc_string);
|
||||
let doc_string = format!("[query description - consider adding a doc-comment!] {doc_string}");
|
||||
Ok(parse_quote! { #[doc = #doc_string] })
|
||||
}
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ fn symbols_with_errors(input: TokenStream) -> (TokenStream, Vec<syn::Error>) {
|
|||
|
||||
let mut check_dup = |span: Span, str: &str, errors: &mut Errors| {
|
||||
if let Some(prev_span) = keys.get(str) {
|
||||
errors.error(span, format!("Symbol `{}` is duplicated", str));
|
||||
errors.error(span, format!("Symbol `{str}` is duplicated"));
|
||||
errors.error(*prev_span, "location of previous definition".to_string());
|
||||
} else {
|
||||
keys.insert(str.to_string(), span);
|
||||
|
@ -144,8 +144,8 @@ fn symbols_with_errors(input: TokenStream) -> (TokenStream, Vec<syn::Error>) {
|
|||
let mut check_order = |span: Span, str: &str, errors: &mut Errors| {
|
||||
if let Some((prev_span, ref prev_str)) = prev_key {
|
||||
if str < prev_str {
|
||||
errors.error(span, format!("Symbol `{}` must precede `{}`", str, prev_str));
|
||||
errors.error(prev_span, format!("location of previous symbol `{}`", prev_str));
|
||||
errors.error(span, format!("Symbol `{str}` must precede `{prev_str}`"));
|
||||
errors.error(prev_span, format!("location of previous symbol `{prev_str}`"));
|
||||
}
|
||||
}
|
||||
prev_key = Some((span, str.to_string()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue