Fix comments

This commit is contained in:
Michael Goulet 2023-12-15 16:08:26 +00:00
parent 7f565ed282
commit 252d99a54b
4 changed files with 3 additions and 37 deletions

View File

@ -520,9 +520,6 @@ pub trait LintContext {
/// Emit a lint at the appropriate level, with an optional associated span and an existing /// Emit a lint at the appropriate level, with an optional associated span and an existing
/// diagnostic. /// 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 /// [`struct_lint_level`]: rustc_middle::lint::struct_lint_level#decorate-signature
#[rustc_lint_diagnostics] #[rustc_lint_diagnostics]
fn lookup_with_diagnostics( fn lookup_with_diagnostics(
@ -984,8 +981,6 @@ pub trait LintContext {
// set the span in their `decorate` function (preferably using set_span). // set the span in their `decorate` function (preferably using set_span).
/// Emit a lint at the appropriate level, with an optional associated 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 /// [`struct_lint_level`]: rustc_middle::lint::struct_lint_level#decorate-signature
#[rustc_lint_diagnostics] #[rustc_lint_diagnostics]
fn lookup<S: Into<MultiSpan>>( fn lookup<S: Into<MultiSpan>>(
@ -1011,8 +1006,6 @@ pub trait LintContext {
/// Emit a lint at the appropriate level, with an associated span. /// 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 /// [`struct_lint_level`]: rustc_middle::lint::struct_lint_level#decorate-signature
#[rustc_lint_diagnostics] #[rustc_lint_diagnostics]
fn struct_span_lint<S: Into<MultiSpan>>( fn struct_span_lint<S: Into<MultiSpan>>(
@ -1035,8 +1028,6 @@ pub trait LintContext {
/// Emit a lint at the appropriate level, with no associated span. /// 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 /// [`struct_lint_level`]: rustc_middle::lint::struct_lint_level#decorate-signature
#[rustc_lint_diagnostics] #[rustc_lint_diagnostics]
fn lint( fn lint(

View File

@ -1093,8 +1093,6 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
/// Used to emit a lint-related diagnostic based on the current state of /// Used to emit a lint-related diagnostic based on the current state of
/// this lint context. /// 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 /// [`struct_lint_level`]: rustc_middle::lint::struct_lint_level#decorate-signature
#[rustc_lint_diagnostics] #[rustc_lint_diagnostics]
#[track_caller] #[track_caller]

View File

@ -253,29 +253,10 @@ pub fn explain_lint_level_source(
/// - [`TyCtxt::struct_lint_node`] /// - [`TyCtxt::struct_lint_node`]
/// - `LintContext::lookup` /// - `LintContext::lookup`
/// ///
/// ## `decorate` signature /// ## `decorate`
/// ///
/// The return value of `decorate` is ignored by this function. So what is the /// It is not intended to call `emit`/`cancel` on the `DiagnosticBuilder` passed
/// point of returning `&'b mut DiagnosticBuilder<'a, ()>`? /// in the `decorate` callback.
///
/// 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
/// )
/// ```
#[track_caller] #[track_caller]
pub fn struct_lint_level( pub fn struct_lint_level(
sess: &Session, sess: &Session,

View File

@ -2036,8 +2036,6 @@ impl<'tcx> TyCtxt<'tcx> {
/// Emit a lint at the appropriate level for a hir node, with an associated span. /// 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 /// [`struct_lint_level`]: rustc_middle::lint::struct_lint_level#decorate-signature
#[rustc_lint_diagnostics] #[rustc_lint_diagnostics]
#[track_caller] #[track_caller]
@ -2069,8 +2067,6 @@ impl<'tcx> TyCtxt<'tcx> {
/// Emit a lint at the appropriate level for a hir node. /// 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 /// [`struct_lint_level`]: rustc_middle::lint::struct_lint_level#decorate-signature
#[rustc_lint_diagnostics] #[rustc_lint_diagnostics]
#[track_caller] #[track_caller]