From dc37dddeb5b7d0f4f602d3a4b875beb7188ddc23 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 29 Feb 2024 11:58:51 +1100 Subject: [PATCH 1/2] Rename `DiagnosticMessage` as `DiagMessage`. --- tests/ui-internal/disallow_span_lint.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/ui-internal/disallow_span_lint.rs b/tests/ui-internal/disallow_span_lint.rs index b9b4a07d29d0e..c5029bbd9a425 100644 --- a/tests/ui-internal/disallow_span_lint.rs +++ b/tests/ui-internal/disallow_span_lint.rs @@ -5,12 +5,17 @@ extern crate rustc_hir; extern crate rustc_lint; extern crate rustc_middle; -use rustc_errors::{DiagnosticMessage, MultiSpan}; +use rustc_errors::{DiagMessage, MultiSpan}; use rustc_hir::hir_id::HirId; use rustc_lint::{Lint, LintContext}; use rustc_middle::ty::TyCtxt; -pub fn a(cx: impl LintContext, lint: &'static Lint, span: impl Into, msg: impl Into) { +pub fn a( + cx: impl LintContext, + lint: &'static Lint, + span: impl Into, + msg: impl Into) +{ cx.span_lint(lint, span, msg, |_| {}); } @@ -19,7 +24,7 @@ pub fn b( lint: &'static Lint, hir_id: HirId, span: impl Into, - msg: impl Into, + msg: impl Into, ) { tcx.node_span_lint(lint, hir_id, span, msg, |_| {}); } From ec920ce096551764ccf79b9e480d2f133e30c504 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 29 Feb 2024 16:34:08 +1100 Subject: [PATCH 2/2] Rename `DiagnosticExt` as `DiagExt`. --- clippy_lints/src/inline_fn_without_body.rs | 2 +- clippy_lints/src/new_without_default.rs | 2 +- clippy_utils/src/sugg.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/clippy_lints/src/inline_fn_without_body.rs b/clippy_lints/src/inline_fn_without_body.rs index bc236c5c71fd8..83ecaeef98257 100644 --- a/clippy_lints/src/inline_fn_without_body.rs +++ b/clippy_lints/src/inline_fn_without_body.rs @@ -1,7 +1,7 @@ //! checks for `#[inline]` on trait methods without bodies use clippy_utils::diagnostics::span_lint_and_then; -use clippy_utils::sugg::DiagnosticExt; +use clippy_utils::sugg::DiagExt; use rustc_ast::ast::Attribute; use rustc_errors::Applicability; use rustc_hir::{TraitFn, TraitItem, TraitItemKind}; diff --git a/clippy_lints/src/new_without_default.rs b/clippy_lints/src/new_without_default.rs index b3b8a5e99638a..627b4968d9f68 100644 --- a/clippy_lints/src/new_without_default.rs +++ b/clippy_lints/src/new_without_default.rs @@ -1,7 +1,7 @@ use clippy_utils::diagnostics::span_lint_hir_and_then; use clippy_utils::return_ty; use clippy_utils::source::snippet; -use clippy_utils::sugg::DiagnosticExt; +use clippy_utils::sugg::DiagExt; use rustc_errors::Applicability; use rustc_hir as hir; use rustc_hir::HirIdSet; diff --git a/clippy_utils/src/sugg.rs b/clippy_utils/src/sugg.rs index d2ec327534a8d..e74621a0fbbaa 100644 --- a/clippy_utils/src/sugg.rs +++ b/clippy_utils/src/sugg.rs @@ -685,7 +685,7 @@ fn indentation(cx: &T, span: Span) -> Option { } /// Convenience extension trait for `Diag`. -pub trait DiagnosticExt { +pub trait DiagExt { /// Suggests to add an attribute to an item. /// /// Correctly handles indentation of the attribute and item. @@ -732,7 +732,7 @@ pub trait DiagnosticExt { fn suggest_remove_item(&mut self, cx: &T, item: Span, msg: &str, applicability: Applicability); } -impl DiagnosticExt for rustc_errors::Diag<'_, ()> { +impl DiagExt for rustc_errors::Diag<'_, ()> { fn suggest_item_with_attr( &mut self, cx: &T,