Skip to content

Commit b5effa4

Browse files
committed
Fix linter
1 parent f577d71 commit b5effa4

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

clippy_lints/src/doc/broken_link.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ use rustc_span::{BytePos, Pos, Span};
77
use super::DOC_BROKEN_LINK;
88

99
/// Scan and report broken link on documents.
10-
/// It ignores false positives detected by pulldown_cmark, and only
10+
/// It ignores false positives detected by `pulldown_cmark`, and only
1111
/// warns users when the broken link is consider a URL.
1212
// NOTE: We don't check these other cases because
1313
// rustdoc itself will check and warn about it:
1414
// - When a link url is broken across multiple lines in the URL path part
1515
// - When a link tag is missing the close parenthesis character at the end.
1616
// - When a link has whitespace within the url link.
17-
pub fn check(cx: &LateContext<'_>, bl: &PullDownBrokenLink<'_>, doc: &String, fragments: &Vec<DocFragment>) {
17+
pub fn check(cx: &LateContext<'_>, bl: &PullDownBrokenLink<'_>, doc: &str, fragments: &[DocFragment]) {
1818
warn_if_broken_link(cx, bl, doc, fragments);
1919
}
2020

21-
fn warn_if_broken_link(cx: &LateContext<'_>, bl: &PullDownBrokenLink<'_>, doc: &String, fragments: &Vec<DocFragment>) {
21+
fn warn_if_broken_link(cx: &LateContext<'_>, bl: &PullDownBrokenLink<'_>, doc: &str, fragments: &[DocFragment]) {
2222
if let Some(span) = source_span_for_markdown_range(cx.tcx, doc, &bl.span, fragments) {
2323
let mut len = 0;
2424

clippy_lints/src/doc/mod.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -818,21 +818,20 @@ fn check_attrs(cx: &LateContext<'_>, valid_idents: &FxHashSet<String>, attrs: &[
818818
// We don't want the parser to choke on intra doc links. Since we don't
819819
// actually care about rendering them, just pretend that all broken links
820820
// point to a fake address.
821+
#[expect(clippy::unnecessary_wraps)] // we're following a type signature
822+
fn light_fake_broken_link_callback<'a>(_: BrokenLink<'_>) -> Option<(CowStr<'a>, CowStr<'a>)> {
823+
Some(("fake".into(), "fake".into()))
824+
}
825+
821826
// NOTE: use this full cb version only for the check_doc function.
822827
// Otherwise, using it as callback for more functions will cause,
823828
// duplicated diagnostics for the broken link checker.
824829
// Use the light cb version for the other cases.
825-
#[expect(clippy::unnecessary_wraps)] // we're following a type signature
826830
let mut full_fake_broken_link_callback = |bl: BrokenLink<'_>| -> Option<(CowStr<'_>, CowStr<'_>)> {
827831
broken_link::check(cx, &bl, &doc, &fragments);
828832
Some(("fake".into(), "fake".into()))
829833
};
830834

831-
#[expect(clippy::unnecessary_wraps)] // we're following a type signature
832-
fn light_fake_broken_link_callback<'a>(_: BrokenLink<'_>) -> Option<(CowStr<'a>, CowStr<'a>)> {
833-
Some(("fake".into(), "fake".into()))
834-
}
835-
836835
check_for_code_clusters(
837836
cx,
838837
pulldown_cmark::Parser::new_with_broken_link_callback(

0 commit comments

Comments
 (0)