Skip to content

Commit fe5bccb

Browse files
committed
rustdoc(rustdoc::bare_urls): apply code review suggestions
1 parent c6d7696 commit fe5bccb

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

compiler/rustc_resolve/src/rustdoc.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,9 +504,12 @@ pub fn span_of_fragments(fragments: &[DocFragment]) -> Option<Span> {
504504
/// This method will return `Some` only if one of the following is true:
505505
///
506506
/// - The doc is made entirely from sugared doc comments, which cannot contain escapes
507-
/// - The doc is entirely from a single doc fragment, with a string literal, exactly equal
507+
/// - The doc is entirely from a single doc fragment with a string literal exactly equal to `markdown`.
508508
/// - The doc comes from `include_str!`
509509
/// - The doc includes exactly one substring matching `markdown[md_range]` which is contained in a single doc fragment.
510+
///
511+
/// This function is defined in the compiler so it can be used by
512+
/// both `rustdoc` and `clippy`.
510513
pub fn source_span_for_markdown_range(
511514
tcx: TyCtxt<'_>,
512515
markdown: &str,

src/librustdoc/passes/lint/bare_urls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub(super) fn visit_item(cx: &DocContext<'_>, item: &Item, hir_id: HirId, dox: &
2323
cx.tcx.node_span_lint(crate::lint::BARE_URLS, hir_id, sp, |lint| {
2424
lint.primary_message(msg)
2525
.note("bare URLs are not automatically turned into clickable links");
26-
// the fallback of using the item span is suitible for
26+
// the fallback of using the attribute span is suitable for
2727
// highlighting where the error is, but not for placing the < and >
2828
if let Some(sp) = maybe_sp {
2929
lint.multipart_suggestion(

tests/rustdoc-ui/lints/bare-urls-limit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
// examples of bare urls that are beyond our ability to generate suggestions for
66

7-
// this falls through every heirustic in `source_span_for_markdown_range`,
7+
// this falls through every heuristic in `source_span_for_markdown_range`,
88
// and thus does not get any suggestion.
99
#[doc = "good: <https://example.com/> \n\n"]
1010
//~^ ERROR this URL is not a hyperlink

0 commit comments

Comments
 (0)