Repository: rust-lang/rust
Pull request: Remove more BuiltinLintDiag variants - part 3

Part of https://github.com/rust-lang/rust/issues/153099.

Last part of the "easy" migration.

r? @JonathanBrouwer

Changed files:
filename: compiler/rustc_lint/src/early/diagnostics.rs
patch: @@ -153,9 +153,6 @@ impl<'a> Diagnostic<'a, ()> for DecorateBuiltinLint<'_, '_> {
                 .into_diag(dcx, level)
             }
 
-            BuiltinLintDiag::UnusedCrateDependency { extern_crate, local_crate } => {
-                lints::UnusedCrateDependency { extern_crate, local_crate }.into_diag(dcx, level)
-            }
             BuiltinLintDiag::AttributeLint(kind) => {
                 DecorateAttrLint { sess: self.sess, tcx: self.tcx, diagnostic: &kind }
                     .into_diag(dcx, level)

filename: compiler/rustc_lint/src/lints.rs
patch: @@ -2994,14 +2994,6 @@ pub(crate) mod unexpected_cfg_value {
     }
 }
 
-#[derive(Diagnostic)]
-#[diag("extern crate `{$extern_crate}` is unused in crate `{$local_crate}`")]
-#[help("remove the dependency or add `use {$extern_crate} as _;` to the crate root")]
-pub(crate) struct UnusedCrateDependency {
-    pub extern_crate: Symbol,
-    pub local_crate: Symbol,
-}
-
 // FIXME(jdonszelmann): duplicated in rustc_attr_parsing, should be moved there completely.
 #[derive(Diagnostic)]
 #[diag(

filename: compiler/rustc_lint_defs/src/lib.rs
patch: @@ -690,10 +690,6 @@ pub enum BuiltinLintDiag {
         /// Indicates if the named argument is used as a width/precision for formatting
         is_formatting_arg: bool,
     },
-    UnusedCrateDependency {
-        extern_crate: Symbol,
-        local_crate: Symbol,
-    },
     AttributeLint(AttributeLintKind),
 }
 

filename: compiler/rustc_metadata/src/creader.rs
patch: @@ -23,15 +23,14 @@ use rustc_middle::bug;
 use rustc_middle::ty::data_structures::IndexSet;
 use rustc_middle::ty::{TyCtxt, TyCtxtFeed};
 use rustc_proc_macro::bridge::client::ProcMacro;
-use rustc_session::Session;
 use rustc_session::config::{
     CrateType, ExtendedTargetModifierInfo, ExternLocation, Externs, OptionsTargetModifiers,
     TargetModifier,
 };
 use rustc_session::cstore::{CrateDepKind, CrateSource, ExternCrate, ExternCrateSource};
-use rustc_session::lint::{self, BuiltinLintDiag};
 use rustc_session::output::validate_crate_name;
 use rustc_session::search_paths::PathKind;
+use rustc_session::{Session, lint};
 use rustc_span::def_id::DefId;
 use rustc_span::edition::Edition;
 use rustc_span::{DUMMY_SP, Ident, Span, Symbol, sym};
@@ -1211,7 +1210,7 @@ impl CStore {
                 lint::builtin::UNUSED_CRATE_DEPENDENCIES,
                 span,
                 ast::CRATE_NODE_ID,
-                BuiltinLintDiag::UnusedCrateDependency {
+                errors::UnusedCrateDependency {
                     extern_crate: name_interned,
                     local_crate: tcx.crate_name(LOCAL_CRATE),
                 },

filename: compiler/rustc_metadata/src/errors.rs
patch: @@ -688,3 +688,11 @@ pub struct RawDylibMalformed {
     #[primary_span]
     pub span: Span,
 }
+
+#[derive(Diagnostic)]
+#[diag("extern crate `{$extern_crate}` is unused in crate `{$local_crate}`")]
+#[help("remove the dependency or add `use {$extern_crate} as _;` to the crate root")]
+pub(crate) struct UnusedCrateDependency {
+    pub extern_crate: Symbol,
+    pub local_crate: Symbol,
+}