From 0aafd6552b58a924d1adf6845683fd20d87289f2 Mon Sep 17 00:00:00 2001 From: Philipp Krones Date: Fri, 8 Nov 2024 10:04:38 +0100 Subject: [PATCH] Clippy: cfg out validate_diag on release builds --- src/tools/clippy/clippy_utils/src/diagnostics.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/tools/clippy/clippy_utils/src/diagnostics.rs b/src/tools/clippy/clippy_utils/src/diagnostics.rs index 993035001c1..ddb7a6635e0 100644 --- a/src/tools/clippy/clippy_utils/src/diagnostics.rs +++ b/src/tools/clippy/clippy_utils/src/diagnostics.rs @@ -8,9 +8,9 @@ //! Thank you! //! ~The `INTERNAL_METADATA_COLLECTOR` lint -use rustc_errors::{ - Applicability, Diag, DiagMessage, EmissionGuarantee, MultiSpan, SubdiagMessage, SubstitutionPart, Suggestions, -}; +use rustc_errors::{Applicability, Diag, DiagMessage, MultiSpan, SubdiagMessage}; +#[cfg(debug_assertions)] +use rustc_errors::{EmissionGuarantee, SubstitutionPart, Suggestions}; use rustc_hir::HirId; use rustc_lint::{LateContext, Lint, LintContext}; use rustc_span::Span; @@ -38,6 +38,7 @@ fn docs_link(diag: &mut Diag<'_, ()>, lint: &'static Lint) { /// only started triggered there. /// /// This function makes sure we also validate them in debug clippy builds. +#[cfg(debug_assertions)] fn validate_diag(diag: &Diag<'_, impl EmissionGuarantee>) { let suggestions = match &diag.suggestions { Suggestions::Enabled(suggs) => &**suggs,