Fix comments
This commit is contained in:
parent
7f565ed282
commit
252d99a54b
@ -520,9 +520,6 @@ pub trait LintContext {
|
||||
/// Emit a lint at the appropriate level, with an optional associated span and an existing
|
||||
/// diagnostic.
|
||||
///
|
||||
/// Return value of the `decorate` closure is ignored, see [`struct_lint_level`] for a detailed
|
||||
/// explanation.
|
||||
///
|
||||
/// [`struct_lint_level`]: rustc_middle::lint::struct_lint_level#decorate-signature
|
||||
#[rustc_lint_diagnostics]
|
||||
fn lookup_with_diagnostics(
|
||||
@ -984,8 +981,6 @@ fn lookup_with_diagnostics(
|
||||
// set the span in their `decorate` function (preferably using set_span).
|
||||
/// Emit a lint at the appropriate level, with an optional associated span.
|
||||
///
|
||||
/// Return value of the `decorate` closure is ignored, see [`struct_lint_level`] for a detailed explanation.
|
||||
///
|
||||
/// [`struct_lint_level`]: rustc_middle::lint::struct_lint_level#decorate-signature
|
||||
#[rustc_lint_diagnostics]
|
||||
fn lookup<S: Into<MultiSpan>>(
|
||||
@ -1011,8 +1006,6 @@ fn emit_spanned_lint<S: Into<MultiSpan>>(
|
||||
|
||||
/// Emit a lint at the appropriate level, with an associated span.
|
||||
///
|
||||
/// Return value of the `decorate` closure is ignored, see [`struct_lint_level`] for a detailed explanation.
|
||||
///
|
||||
/// [`struct_lint_level`]: rustc_middle::lint::struct_lint_level#decorate-signature
|
||||
#[rustc_lint_diagnostics]
|
||||
fn struct_span_lint<S: Into<MultiSpan>>(
|
||||
@ -1035,8 +1028,6 @@ fn emit_lint(&self, lint: &'static Lint, decorator: impl for<'a> DecorateLint<'a
|
||||
|
||||
/// Emit a lint at the appropriate level, with no associated span.
|
||||
///
|
||||
/// Return value of the `decorate` closure is ignored, see [`struct_lint_level`] for a detailed explanation.
|
||||
///
|
||||
/// [`struct_lint_level`]: rustc_middle::lint::struct_lint_level#decorate-signature
|
||||
#[rustc_lint_diagnostics]
|
||||
fn lint(
|
||||
|
@ -1093,8 +1093,6 @@ pub fn lint_level(&self, lint: &'static Lint) -> LevelAndSource {
|
||||
/// Used to emit a lint-related diagnostic based on the current state of
|
||||
/// this lint context.
|
||||
///
|
||||
/// Return value of the `decorate` closure is ignored, see [`struct_lint_level`] for a detailed explanation.
|
||||
///
|
||||
/// [`struct_lint_level`]: rustc_middle::lint::struct_lint_level#decorate-signature
|
||||
#[rustc_lint_diagnostics]
|
||||
#[track_caller]
|
||||
|
@ -253,29 +253,10 @@ pub fn explain_lint_level_source(
|
||||
/// - [`TyCtxt::struct_lint_node`]
|
||||
/// - `LintContext::lookup`
|
||||
///
|
||||
/// ## `decorate` signature
|
||||
/// ## `decorate`
|
||||
///
|
||||
/// The return value of `decorate` is ignored by this function. So what is the
|
||||
/// point of returning `&'b mut DiagnosticBuilder<'a, ()>`?
|
||||
///
|
||||
/// There are 2 reasons for this signature.
|
||||
///
|
||||
/// First of all, it prevents accidental use of `.emit()` -- it's clear that the
|
||||
/// builder will be later used and shouldn't be emitted right away (this is
|
||||
/// especially important because the old API expected you to call `.emit()` in
|
||||
/// the closure).
|
||||
///
|
||||
/// Second of all, it makes the most common case of adding just a single label
|
||||
/// /suggestion much nicer, since [`DiagnosticBuilder`] methods return
|
||||
/// `&mut DiagnosticBuilder`, you can just chain methods, without needed
|
||||
/// awkward `{ ...; }`:
|
||||
/// ```ignore pseudo-code
|
||||
/// struct_lint_level(
|
||||
/// ...,
|
||||
/// |lint| lint.span_label(sp, "lbl")
|
||||
/// // ^^^^^^^^^^^^^^^^^^^^^ returns `&mut DiagnosticBuilder` by default
|
||||
/// )
|
||||
/// ```
|
||||
/// It is not intended to call `emit`/`cancel` on the `DiagnosticBuilder` passed
|
||||
/// in the `decorate` callback.
|
||||
#[track_caller]
|
||||
pub fn struct_lint_level(
|
||||
sess: &Session,
|
||||
|
@ -2036,8 +2036,6 @@ pub fn emit_spanned_lint(
|
||||
|
||||
/// Emit a lint at the appropriate level for a hir node, with an associated span.
|
||||
///
|
||||
/// Return value of the `decorate` closure is ignored, see [`struct_lint_level`] for a detailed explanation.
|
||||
///
|
||||
/// [`struct_lint_level`]: rustc_middle::lint::struct_lint_level#decorate-signature
|
||||
#[rustc_lint_diagnostics]
|
||||
#[track_caller]
|
||||
@ -2069,8 +2067,6 @@ pub fn emit_lint(
|
||||
|
||||
/// Emit a lint at the appropriate level for a hir node.
|
||||
///
|
||||
/// Return value of the `decorate` closure is ignored, see [`struct_lint_level`] for a detailed explanation.
|
||||
///
|
||||
/// [`struct_lint_level`]: rustc_middle::lint::struct_lint_level#decorate-signature
|
||||
#[rustc_lint_diagnostics]
|
||||
#[track_caller]
|
||||
|
Loading…
Reference in New Issue
Block a user