diff options
| author | Joshua Nelson <jyn514@gmail.com> | 2021-03-27 23:35:02 -0400 |
|---|---|---|
| committer | Joshua Nelson <jyn514@gmail.com> | 2021-04-05 04:13:34 -0400 |
| commit | ef4e5b9ecb10480cd87bd7875e4169ca5edeb0fd (patch) | |
| tree | 7849b50f935a5dc1b7fda7b1103ca509ac63e367 /src/librustdoc/passes | |
| parent | 6f89468fc513eb12ef8a1137a70fab8bb9f50f14 (diff) | |
| download | rust-ef4e5b9ecb10480cd87bd7875e4169ca5edeb0fd.tar.gz rust-ef4e5b9ecb10480cd87bd7875e4169ca5edeb0fd.zip | |
Rename non_autolinks -> bare_urls
Diffstat (limited to 'src/librustdoc/passes')
| -rw-r--r-- | src/librustdoc/passes/bare_urls.rs (renamed from src/librustdoc/passes/non_autolinks.rs) | 20 | ||||
| -rw-r--r-- | src/librustdoc/passes/mod.rs | 8 |
2 files changed, 14 insertions, 14 deletions
diff --git a/src/librustdoc/passes/non_autolinks.rs b/src/librustdoc/passes/bare_urls.rs index 0ebd1879db5..3f2e1c68c55 100644 --- a/src/librustdoc/passes/non_autolinks.rs +++ b/src/librustdoc/passes/bare_urls.rs @@ -10,10 +10,10 @@ use rustc_errors::Applicability; use std::lazy::SyncLazy; use std::mem; -crate const CHECK_NON_AUTOLINKS: Pass = Pass { - name: "check-non-autolinks", - run: check_non_autolinks, - description: "detects URLs that could be linkified", +crate const CHECK_BARE_URLS: Pass = Pass { + name: "check-bare-urls", + run: check_bare_urls, + description: "detects URLs that are not hyperlinks", }; const URL_REGEX: SyncLazy<Regex> = SyncLazy::new(|| { @@ -26,11 +26,11 @@ const URL_REGEX: SyncLazy<Regex> = SyncLazy::new(|| { .expect("failed to build regex") }); -struct NonAutolinksLinter<'a, 'tcx> { +struct BareUrlsLinter<'a, 'tcx> { cx: &'a mut DocContext<'tcx>, } -impl<'a, 'tcx> NonAutolinksLinter<'a, 'tcx> { +impl<'a, 'tcx> BareUrlsLinter<'a, 'tcx> { fn find_raw_urls( &self, text: &str, @@ -52,11 +52,11 @@ impl<'a, 'tcx> NonAutolinksLinter<'a, 'tcx> { } } -crate fn check_non_autolinks(krate: Crate, cx: &mut DocContext<'_>) -> Crate { - NonAutolinksLinter { cx }.fold_crate(krate) +crate fn check_bare_urls(krate: Crate, cx: &mut DocContext<'_>) -> Crate { + BareUrlsLinter { cx }.fold_crate(krate) } -impl<'a, 'tcx> DocFolder for NonAutolinksLinter<'a, 'tcx> { +impl<'a, 'tcx> DocFolder for BareUrlsLinter<'a, 'tcx> { fn fold_item(&mut self, item: Item) -> Option<Item> { let hir_id = match DocContext::as_local_hir_id(self.cx.tcx, item.def_id) { Some(hir_id) => hir_id, @@ -71,7 +71,7 @@ impl<'a, 'tcx> DocFolder for NonAutolinksLinter<'a, 'tcx> { let sp = super::source_span_for_markdown_range(cx.tcx, &dox, &range, &item.attrs) .or_else(|| span_of_attrs(&item.attrs)) .unwrap_or(item.span.inner()); - cx.tcx.struct_span_lint_hir(crate::lint::NON_AUTOLINKS, hir_id, sp, |lint| { + cx.tcx.struct_span_lint_hir(crate::lint::BARE_URLS, hir_id, sp, |lint| { lint.build(msg) .span_suggestion( sp, diff --git a/src/librustdoc/passes/mod.rs b/src/librustdoc/passes/mod.rs index 755217a4629..4cc2f7120a0 100644 --- a/src/librustdoc/passes/mod.rs +++ b/src/librustdoc/passes/mod.rs @@ -12,8 +12,8 @@ use crate::core::DocContext; mod stripper; crate use stripper::*; -mod non_autolinks; -crate use self::non_autolinks::CHECK_NON_AUTOLINKS; +mod bare_urls; +crate use self::bare_urls::CHECK_BARE_URLS; mod strip_hidden; crate use self::strip_hidden::STRIP_HIDDEN; @@ -90,7 +90,7 @@ crate const PASSES: &[Pass] = &[ COLLECT_TRAIT_IMPLS, CALCULATE_DOC_COVERAGE, CHECK_INVALID_HTML_TAGS, - CHECK_NON_AUTOLINKS, + CHECK_BARE_URLS, ]; /// The list of passes run by default. @@ -105,7 +105,7 @@ crate const DEFAULT_PASSES: &[ConditionalPass] = &[ ConditionalPass::always(CHECK_CODE_BLOCK_SYNTAX), ConditionalPass::always(CHECK_INVALID_HTML_TAGS), ConditionalPass::always(PROPAGATE_DOC_CFG), - ConditionalPass::always(CHECK_NON_AUTOLINKS), + ConditionalPass::always(CHECK_BARE_URLS), ]; /// The list of default passes run when `--doc-coverage` is passed to rustdoc. |
