Skip to content

Commit d46c56f

Browse files
committed
Undo changes to clippy_utils/src/diagnostics.rs
1 parent 0efbf08 commit d46c56f

File tree

1 file changed

+0
-36
lines changed

1 file changed

+0
-36
lines changed

clippy_utils/src/diagnostics.rs

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,13 @@
88
//! Thank you!
99
//! ~The `INTERNAL_METADATA_COLLECTOR` lint
1010
11-
use rustc_data_structures::fx::FxHashSet;
1211
use rustc_errors::{Applicability, Diag, DiagMessage, MultiSpan, SubdiagMessage};
1312
#[cfg(debug_assertions)]
1413
use rustc_errors::{EmissionGuarantee, SubstitutionPart, Suggestions};
1514
use rustc_hir::HirId;
1615
use rustc_lint::{LateContext, Lint, LintContext};
1716
use rustc_span::Span;
1817
use std::env;
19-
use std::sync::OnceLock;
20-
21-
pub static DISABLED: OnceLock<FxHashSet<&'static str>> = OnceLock::new();
22-
23-
#[allow(clippy::implicit_hasher)]
24-
pub fn set_disabled(disabled: FxHashSet<&'static str>) {
25-
DISABLED
26-
.set(disabled)
27-
.unwrap_or_else(|_| panic!("`set_disabled` was already called"));
28-
}
29-
30-
fn is_disabled(lint: &Lint) -> bool {
31-
DISABLED.get().is_some_and(|disabled| {
32-
let name = lint.name_lower();
33-
disabled.contains(name.strip_prefix("clippy::").unwrap_or(&name))
34-
})
35-
}
3618

3719
fn docs_link(diag: &mut Diag<'_, ()>, lint: &'static Lint) {
3820
if env::var("CLIPPY_DISABLE_DOCS_LINKS").is_err()
@@ -122,9 +104,6 @@ fn validate_diag(diag: &Diag<'_, impl EmissionGuarantee>) {
122104
/// ```
123105
#[track_caller]
124106
pub fn span_lint<T: LintContext>(cx: &T, lint: &'static Lint, sp: impl Into<MultiSpan>, msg: impl Into<DiagMessage>) {
125-
if is_disabled(lint) {
126-
return;
127-
}
128107
#[expect(clippy::disallowed_methods)]
129108
cx.span_lint(lint, sp, |diag| {
130109
diag.primary_message(msg);
@@ -178,9 +157,6 @@ pub fn span_lint_and_help<T: LintContext>(
178157
help_span: Option<Span>,
179158
help: impl Into<SubdiagMessage>,
180159
) {
181-
if is_disabled(lint) {
182-
return;
183-
}
184160
#[expect(clippy::disallowed_methods)]
185161
cx.span_lint(lint, span, |diag| {
186162
diag.primary_message(msg);
@@ -242,9 +218,6 @@ pub fn span_lint_and_note<T: LintContext>(
242218
note_span: Option<Span>,
243219
note: impl Into<SubdiagMessage>,
244220
) {
245-
if is_disabled(lint) {
246-
return;
247-
}
248221
#[expect(clippy::disallowed_methods)]
249222
cx.span_lint(lint, span, |diag| {
250223
diag.primary_message(msg);
@@ -286,9 +259,6 @@ where
286259
M: Into<DiagMessage>,
287260
F: FnOnce(&mut Diag<'_, ()>),
288261
{
289-
if is_disabled(lint) {
290-
return;
291-
}
292262
#[expect(clippy::disallowed_methods)]
293263
cx.span_lint(lint, sp, |diag| {
294264
diag.primary_message(msg);
@@ -326,9 +296,6 @@ where
326296
/// the `#[allow]` will work.
327297
#[track_caller]
328298
pub fn span_lint_hir(cx: &LateContext<'_>, lint: &'static Lint, hir_id: HirId, sp: Span, msg: impl Into<DiagMessage>) {
329-
if is_disabled(lint) {
330-
return;
331-
}
332299
#[expect(clippy::disallowed_methods)]
333300
cx.tcx.node_span_lint(lint, hir_id, sp, |diag| {
334301
diag.primary_message(msg);
@@ -372,9 +339,6 @@ pub fn span_lint_hir_and_then(
372339
msg: impl Into<DiagMessage>,
373340
f: impl FnOnce(&mut Diag<'_, ()>),
374341
) {
375-
if is_disabled(lint) {
376-
return;
377-
}
378342
#[expect(clippy::disallowed_methods)]
379343
cx.tcx.node_span_lint(lint, hir_id, sp, |diag| {
380344
diag.primary_message(msg);

0 commit comments

Comments
 (0)