]> git.proxmox.com Git - rustc.git/blobdiff - compiler/rustc_macros/src/diagnostics/diagnostic.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / compiler / rustc_macros / src / diagnostics / diagnostic.rs
index 684835d8c5c86b88e60713d8639ab1962a4eb0da..9ff944864047753173598cdbe56778f022e2e919 100644 (file)
@@ -39,10 +39,8 @@ impl<'a> DiagnosticDerive<'a> {
             let init = match builder.slug.value_ref() {
                 None => {
                     span_err(builder.span, "diagnostic slug not specified")
-                        .help(format!(
-                            "specify the slug as the first argument to the `#[diag(...)]` \
-                            attribute, such as `#[diag(hir_analysis_example_error)]`",
-                        ))
+                        .help("specify the slug as the first argument to the `#[diag(...)]` \
+                            attribute, such as `#[diag(hir_analysis_example_error)]`")
                         .emit();
                     return DiagnosticDeriveError::ErrorHandled.to_compile_error();
                 }
@@ -133,10 +131,8 @@ impl<'a> LintDiagnosticDerive<'a> {
             match builder.slug.value_ref() {
                 None => {
                     span_err(builder.span, "diagnostic slug not specified")
-                        .help(format!(
-                            "specify the slug as the first argument to the attribute, such as \
-                            `#[diag(compiletest_example)]`",
-                        ))
+                        .help("specify the slug as the first argument to the attribute, such as \
+                            `#[diag(compiletest_example)]`")
                         .emit();
                     DiagnosticDeriveError::ErrorHandled.to_compile_error()
                 }
@@ -192,7 +188,7 @@ impl Mismatch {
         let crate_name = std::env::var("CARGO_CRATE_NAME").ok()?;
 
         // If we're not in a "rustc_" crate, bail.
-        let Some(("rustc", slug_prefix)) = crate_name.split_once("_") else { return None };
+        let Some(("rustc", slug_prefix)) = crate_name.split_once('_') else { return None };
 
         let slug_name = slug.segments.first()?.ident.to_string();
         if !slug_name.starts_with(slug_prefix) {