Skip to content

Commit 88483bd

Browse files
committed
Replace &mut DiagnosticBuilder, in signatures, with &mut Diagnostic.
1 parent e390e6c commit 88483bd

File tree

7 files changed

+17
-17
lines changed

7 files changed

+17
-17
lines changed

clippy_lints/src/copies.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use clippy_utils::{
66
};
77
use if_chain::if_chain;
88
use rustc_data_structures::fx::FxHashSet;
9-
use rustc_errors::{Applicability, DiagnosticBuilder};
9+
use rustc_errors::{Applicability, Diagnostic};
1010
use rustc_hir::intravisit::{self, Visitor};
1111
use rustc_hir::{Block, Expr, ExprKind, HirId};
1212
use rustc_lint::{LateContext, LateLintPass, LintContext};
@@ -489,7 +489,7 @@ fn emit_branches_sharing_code_lint(
489489
add_expr_note = !cx.typeck_results().expr_ty(if_expr).is_unit();
490490
}
491491

492-
let add_optional_msgs = |diag: &mut DiagnosticBuilder<'_>| {
492+
let add_optional_msgs = |diag: &mut Diagnostic| {
493493
if add_expr_note {
494494
diag.note("The end suggestion probably needs some adjustments to use the expression result correctly");
495495
}

clippy_lints/src/implicit_hasher.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::borrow::Cow;
22
use std::collections::BTreeMap;
33

4-
use rustc_errors::DiagnosticBuilder;
4+
use rustc_errors::Diagnostic;
55
use rustc_hir as hir;
66
use rustc_hir::intravisit::{walk_body, walk_expr, walk_inf, walk_ty, Visitor};
77
use rustc_hir::{Body, Expr, ExprKind, GenericArg, Item, ItemKind, QPath, TyKind};
@@ -68,7 +68,7 @@ impl<'tcx> LateLintPass<'tcx> for ImplicitHasher {
6868

6969
fn suggestion<'tcx>(
7070
cx: &LateContext<'tcx>,
71-
diag: &mut DiagnosticBuilder<'_>,
71+
diag: &mut Diagnostic,
7272
generics_span: Span,
7373
generics_suggestion_span: Span,
7474
target: &ImplicitHasherType<'_>,

clippy_lints/src/inline_fn_without_body.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! checks for `#[inline]` on trait methods without bodies
22
33
use clippy_utils::diagnostics::span_lint_and_then;
4-
use clippy_utils::sugg::DiagnosticBuilderExt;
4+
use clippy_utils::sugg::DiagnosticExt;
55
use rustc_ast::ast::Attribute;
66
use rustc_errors::Applicability;
77
use rustc_hir::{TraitFn, TraitItem, TraitItemKind};

clippy_lints/src/needless_pass_by_value.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use clippy_utils::{get_trait_def_id, is_self, paths};
66
use if_chain::if_chain;
77
use rustc_ast::ast::Attribute;
88
use rustc_data_structures::fx::FxHashSet;
9-
use rustc_errors::{Applicability, DiagnosticBuilder};
9+
use rustc_errors::{Applicability, Diagnostic};
1010
use rustc_hir::intravisit::FnKind;
1111
use rustc_hir::{BindingAnnotation, Body, FnDecl, GenericArg, HirId, Impl, ItemKind, Node, PatKind, QPath, TyKind};
1212
use rustc_hir::{HirIdMap, HirIdSet};
@@ -196,7 +196,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue {
196196
}
197197

198198
// Dereference suggestion
199-
let sugg = |diag: &mut DiagnosticBuilder<'_>| {
199+
let sugg = |diag: &mut Diagnostic| {
200200
if let ty::Adt(def, ..) = ty.kind() {
201201
if let Some(span) = cx.tcx.hir().span_if_local(def.did) {
202202
if can_type_implement_copy(cx.tcx, cx.param_env, ty).is_ok() {

clippy_lints/src/new_without_default.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use clippy_utils::diagnostics::span_lint_hir_and_then;
22
use clippy_utils::return_ty;
33
use clippy_utils::source::snippet;
4-
use clippy_utils::sugg::DiagnosticBuilderExt;
4+
use clippy_utils::sugg::DiagnosticExt;
55
use if_chain::if_chain;
66
use rustc_errors::Applicability;
77
use rustc_hir as hir;

clippy_utils/src/diagnostics.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
//! Thank you!
99
//! ~The `INTERNAL_METADATA_COLLECTOR` lint
1010
11-
use rustc_errors::{Applicability, DiagnosticBuilder};
11+
use rustc_errors::{Applicability, Diagnostic};
1212
use rustc_hir::HirId;
1313
use rustc_lint::{LateContext, Lint, LintContext};
1414
use rustc_span::source_map::{MultiSpan, Span};
1515
use std::env;
1616

17-
fn docs_link(diag: &mut DiagnosticBuilder<'_>, lint: &'static Lint) {
17+
fn docs_link(diag: &mut Diagnostic, lint: &'static Lint) {
1818
if env::var("CLIPPY_DISABLE_DOCS_LINKS").is_err() {
1919
if let Some(lint) = lint.name_lower().strip_prefix("clippy::") {
2020
diag.help(&format!(
@@ -145,7 +145,7 @@ pub fn span_lint_and_then<C, S, F>(cx: &C, lint: &'static Lint, sp: S, msg: &str
145145
where
146146
C: LintContext,
147147
S: Into<MultiSpan>,
148-
F: FnOnce(&mut DiagnosticBuilder<'_>),
148+
F: FnOnce(&mut Diagnostic),
149149
{
150150
cx.struct_span_lint(lint, sp, |diag| {
151151
let mut diag = diag.build(msg);
@@ -169,7 +169,7 @@ pub fn span_lint_hir_and_then(
169169
hir_id: HirId,
170170
sp: impl Into<MultiSpan>,
171171
msg: &str,
172-
f: impl FnOnce(&mut DiagnosticBuilder<'_>),
172+
f: impl FnOnce(&mut Diagnostic),
173173
) {
174174
cx.tcx.struct_span_lint_hir(lint, hir_id, sp, |diag| {
175175
let mut diag = diag.build(msg);
@@ -219,7 +219,7 @@ pub fn span_lint_and_sugg<'a, T: LintContext>(
219219
/// appear once per
220220
/// replacement. In human-readable format though, it only appears once before
221221
/// the whole suggestion.
222-
pub fn multispan_sugg<I>(diag: &mut DiagnosticBuilder<'_>, help_msg: &str, sugg: I)
222+
pub fn multispan_sugg<I>(diag: &mut Diagnostic, help_msg: &str, sugg: I)
223223
where
224224
I: IntoIterator<Item = (Span, String)>,
225225
{
@@ -232,7 +232,7 @@ where
232232
/// multiple spans. This is tracked in issue [rustfix#141](https://github.com/rust-lang/rustfix/issues/141).
233233
/// Suggestions with multiple spans will be silently ignored.
234234
pub fn multispan_sugg_with_applicability<I>(
235-
diag: &mut DiagnosticBuilder<'_>,
235+
diag: &mut Diagnostic,
236236
help_msg: &str,
237237
applicability: Applicability,
238238
sugg: I,

clippy_utils/src/sugg.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -673,8 +673,8 @@ fn indentation<T: LintContext>(cx: &T, span: Span) -> Option<String> {
673673
})
674674
}
675675

676-
/// Convenience extension trait for `DiagnosticBuilder`.
677-
pub trait DiagnosticBuilderExt<T: LintContext> {
676+
/// Convenience extension trait for `Diagnostic`.
677+
pub trait DiagnosticExt<T: LintContext> {
678678
/// Suggests to add an attribute to an item.
679679
///
680680
/// Correctly handles indentation of the attribute and item.
@@ -721,7 +721,7 @@ pub trait DiagnosticBuilderExt<T: LintContext> {
721721
fn suggest_remove_item(&mut self, cx: &T, item: Span, msg: &str, applicability: Applicability);
722722
}
723723

724-
impl<T: LintContext> DiagnosticBuilderExt<T> for rustc_errors::DiagnosticBuilder<'_> {
724+
impl<T: LintContext> DiagnosticExt<T> for rustc_errors::Diagnostic {
725725
fn suggest_item_with_attr<D: Display + ?Sized>(
726726
&mut self,
727727
cx: &T,

0 commit comments

Comments
 (0)