Skip to content

Commit

Permalink
Remove rustc_lint_defs::lint_array
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes committed Sep 28, 2023
1 parent c01d8d2 commit ad65326
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
5 changes: 2 additions & 3 deletions compiler/rustc_lint/src/foreign_modules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,18 @@ use rustc_hir::def::DefKind;
use rustc_middle::query::Providers;
use rustc_middle::ty::layout::LayoutError;
use rustc_middle::ty::{self, Instance, Ty, TyCtxt};
use rustc_session::lint::{lint_array, LintArray};
use rustc_span::{sym, Span, Symbol};
use rustc_target::abi::FIRST_VARIANT;

use crate::lints::{BuiltinClashingExtern, BuiltinClashingExternSub};
use crate::types;
use crate::{types, LintArray};

pub(crate) fn provide(providers: &mut Providers) {
*providers = Providers { clashing_extern_declarations, ..*providers };
}

pub(crate) fn get_lints() -> LintArray {
lint_array!(CLASHING_EXTERN_DECLARATIONS)
vec![CLASHING_EXTERN_DECLARATIONS]
}

fn clashing_extern_declarations(tcx: TyCtxt<'_>, (): ()) {
Expand Down
11 changes: 1 addition & 10 deletions compiler/rustc_lint_defs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -785,15 +785,6 @@ macro_rules! declare_tool_lint {
);
}

/// Declares a static `LintArray` and return it as an expression.
#[macro_export]
macro_rules! lint_array {
($( $lint:expr ),* ,) => { lint_array!( $($lint),* ) };
($( $lint:expr ),*) => {{
vec![$($lint),*]
}}
}

pub type LintArray = Vec<&'static Lint>;

pub trait LintPass {
Expand All @@ -808,7 +799,7 @@ macro_rules! impl_lint_pass {
fn name(&self) -> &'static str { stringify!($ty) }
}
impl $ty {
pub fn get_lints() -> $crate::LintArray { $crate::lint_array!($($lint),*) }
pub fn get_lints() -> $crate::LintArray { vec![$($lint),*] }
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ declare_clippy_lint! {
/// know the name of the lint.
///
/// ### Known problems
/// Only checks for lints associated using the
/// `declare_lint_pass!`, `impl_lint_pass!`, and `lint_array!` macros.
/// Only checks for lints associated using the `declare_lint_pass!` and
/// `impl_lint_pass!` macros.
///
/// ### Example
/// ```rust,ignore
Expand Down

0 comments on commit ad65326

Please sign in to comment.