mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Rollup merge of #153609 - GuillaumeGomez:with_span_suggestion_with_style, r=JonathanBrouwer
Add missing `Diag::with_span_suggestion_with_style` method Uncovered while working on https://github.com/rust-lang/rust/pull/153509. r? @jonathanbrouwer
This commit is contained in:
@@ -934,6 +934,7 @@ pub fn span_suggestion(
|
||||
self
|
||||
} }
|
||||
|
||||
with_fn! { with_span_suggestion_with_style,
|
||||
/// [`Diag::span_suggestion()`] but you can set the [`SuggestionStyle`].
|
||||
pub fn span_suggestion_with_style(
|
||||
&mut self,
|
||||
@@ -956,7 +957,7 @@ pub fn span_suggestion_with_style(
|
||||
applicability,
|
||||
});
|
||||
self
|
||||
}
|
||||
} }
|
||||
|
||||
with_fn! { with_span_suggestion_verbose,
|
||||
/// Always show the suggested change.
|
||||
|
||||
@@ -165,7 +165,7 @@ impl<'a> Diagnostic<'a, ()> for RedundantExplicitLinks {
|
||||
fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> {
|
||||
let Self { explicit_span, display_span, link_span, display_link } = self;
|
||||
|
||||
let mut diag = Diag::new(dcx, level, "redundant explicit link target")
|
||||
Diag::new(dcx, level, "redundant explicit link target")
|
||||
.with_span_label(
|
||||
explicit_span,
|
||||
"explicit target is redundant",
|
||||
@@ -176,17 +176,15 @@ fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> {
|
||||
)
|
||||
.with_note(
|
||||
"when a link's destination is not specified,\nthe label is used to resolve intra-doc links"
|
||||
);
|
||||
// FIXME (GuillaumeGomez): We cannot use `derive(Diagnostic)` because of this method.
|
||||
// FIXME2 (GuillaumeGomez): Why isn't there a `with_` equivalent for this method?
|
||||
diag.span_suggestion_with_style(
|
||||
link_span,
|
||||
"remove explicit link target",
|
||||
format!("[{}]", display_link),
|
||||
Applicability::MaybeIncorrect,
|
||||
SuggestionStyle::ShowAlways,
|
||||
);
|
||||
diag
|
||||
)
|
||||
// FIXME (GuillaumeGomez): We cannot use `derive(Diagnostic)` because of this method.
|
||||
.with_span_suggestion_with_style(
|
||||
link_span,
|
||||
"remove explicit link target",
|
||||
format!("[{}]", display_link),
|
||||
Applicability::MaybeIncorrect,
|
||||
SuggestionStyle::ShowAlways,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,7 +265,7 @@ impl<'a> Diagnostic<'a, ()> for RedundantExplicitLinkTarget {
|
||||
fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> {
|
||||
let Self { explicit_span, display_span, def_span, link_span, display_link } = self;
|
||||
|
||||
let mut diag = Diag::new(dcx, level, "redundant explicit link target")
|
||||
Diag::new(dcx, level, "redundant explicit link target")
|
||||
.with_span_label(explicit_span, "explicit target is redundant")
|
||||
.with_span_label(
|
||||
display_span,
|
||||
@@ -276,17 +274,15 @@ fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> {
|
||||
.with_span_note(def_span, "referenced explicit link target defined here")
|
||||
.with_note(
|
||||
"when a link's destination is not specified,\nthe label is used to resolve intra-doc links"
|
||||
);
|
||||
// FIXME (GuillaumeGomez): We cannot use `derive(Diagnostic)` because of this method.
|
||||
// FIXME2 (GuillaumeGomez): Why isn't there a `with_` equivalent for this method?
|
||||
diag.span_suggestion_with_style(
|
||||
link_span,
|
||||
"remove explicit link target",
|
||||
format!("[{}]", display_link),
|
||||
Applicability::MaybeIncorrect,
|
||||
SuggestionStyle::ShowAlways,
|
||||
);
|
||||
diag
|
||||
)
|
||||
// FIXME (GuillaumeGomez): We cannot use `derive(Diagnostic)` because of this method.
|
||||
.with_span_suggestion_with_style(
|
||||
link_span,
|
||||
"remove explicit link target",
|
||||
format!("[{}]", display_link),
|
||||
Applicability::MaybeIncorrect,
|
||||
SuggestionStyle::ShowAlways,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user