//! Thank you!
//! ~The `INTERNAL_METADATA_COLLECTOR` lint
-use rustc_errors::{Applicability, DiagnosticBuilder};
+use rustc_errors::{Applicability, Diagnostic, MultiSpan};
use rustc_hir::HirId;
use rustc_lint::{LateContext, Lint, LintContext};
-use rustc_span::source_map::{MultiSpan, Span};
+use rustc_span::source_map::Span;
use std::env;
-fn docs_link(diag: &mut DiagnosticBuilder<'_>, lint: &'static Lint) {
+fn docs_link(diag: &mut Diagnostic, lint: &'static Lint) {
if env::var("CLIPPY_DISABLE_DOCS_LINKS").is_err() {
if let Some(lint) = lint.name_lower().strip_prefix("clippy::") {
diag.help(&format!(
pub fn span_lint_and_help<'a, T: LintContext>(
cx: &'a T,
lint: &'static Lint,
- span: Span,
+ span: impl Into<MultiSpan>,
msg: &str,
help_span: Option<Span>,
help: &str,
where
C: LintContext,
S: Into<MultiSpan>,
- F: FnOnce(&mut DiagnosticBuilder<'_>),
+ F: FnOnce(&mut Diagnostic),
{
cx.struct_span_lint(lint, sp, |diag| {
let mut diag = diag.build(msg);
hir_id: HirId,
sp: impl Into<MultiSpan>,
msg: &str,
- f: impl FnOnce(&mut DiagnosticBuilder<'_>),
+ f: impl FnOnce(&mut Diagnostic),
) {
cx.tcx.struct_span_lint_hir(lint, hir_id, sp, |diag| {
let mut diag = diag.build(msg);
/// |
/// = note: `-D fold-any` implied by `-D warnings`
/// ```
-#[cfg_attr(feature = "internal-lints", allow(clippy::collapsible_span_lint_calls))]
+#[cfg_attr(feature = "internal", allow(clippy::collapsible_span_lint_calls))]
pub fn span_lint_and_sugg<'a, T: LintContext>(
cx: &'a T,
lint: &'static Lint,
/// appear once per
/// replacement. In human-readable format though, it only appears once before
/// the whole suggestion.
-pub fn multispan_sugg<I>(diag: &mut DiagnosticBuilder<'_>, help_msg: &str, sugg: I)
+pub fn multispan_sugg<I>(diag: &mut Diagnostic, help_msg: &str, sugg: I)
where
I: IntoIterator<Item = (Span, String)>,
{
/// multiple spans. This is tracked in issue [rustfix#141](https://github.com/rust-lang/rustfix/issues/141).
/// Suggestions with multiple spans will be silently ignored.
pub fn multispan_sugg_with_applicability<I>(
- diag: &mut DiagnosticBuilder<'_>,
+ diag: &mut Diagnostic,
help_msg: &str,
applicability: Applicability,
sugg: I,