Skip to content

Commit

Permalink
Auto merge of rust-lang#121780 - nnethercote:diag-renaming2, r=davidtwco
Browse files Browse the repository at this point in the history
Diagnostic renaming 2

A sequel to rust-lang#121489.

r? `@davidtwco`
  • Loading branch information
bors committed Mar 5, 2024
2 parents 415b1f1 + ec920ce commit ae710de
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion clippy_lints/src/inline_fn_without_body.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/new_without_default.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
4 changes: 2 additions & 2 deletions clippy_utils/src/sugg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ fn indentation<T: LintContext>(cx: &T, span: Span) -> Option<String> {
}

/// Convenience extension trait for `Diag`.
pub trait DiagnosticExt<T: LintContext> {
pub trait DiagExt<T: LintContext> {
/// Suggests to add an attribute to an item.
///
/// Correctly handles indentation of the attribute and item.
Expand Down Expand Up @@ -732,7 +732,7 @@ pub trait DiagnosticExt<T: LintContext> {
fn suggest_remove_item(&mut self, cx: &T, item: Span, msg: &str, applicability: Applicability);
}

impl<T: LintContext> DiagnosticExt<T> for rustc_errors::Diag<'_, ()> {
impl<T: LintContext> DiagExt<T> for rustc_errors::Diag<'_, ()> {
fn suggest_item_with_attr<D: Display + ?Sized>(
&mut self,
cx: &T,
Expand Down
11 changes: 8 additions & 3 deletions tests/ui-internal/disallow_span_lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<MultiSpan>, msg: impl Into<DiagnosticMessage>) {
pub fn a(
cx: impl LintContext,
lint: &'static Lint,
span: impl Into<MultiSpan>,
msg: impl Into<DiagMessage>)
{
cx.span_lint(lint, span, msg, |_| {});
}

Expand All @@ -19,7 +24,7 @@ pub fn b(
lint: &'static Lint,
hir_id: HirId,
span: impl Into<MultiSpan>,
msg: impl Into<DiagnosticMessage>,
msg: impl Into<DiagMessage>,
) {
tcx.node_span_lint(lint, hir_id, span, msg, |_| {});
}
Expand Down

0 comments on commit ae710de

Please sign in to comment.