Skip to content

Commit 60caf51

Browse files
Rename automatic_links to url_improvements
1 parent 55b4d21 commit 60caf51

File tree

9 files changed

+29
-29
lines changed

9 files changed

+29
-29
lines changed

compiler/rustc_lint/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ use rustc_hir::def_id::LocalDefId;
6767
use rustc_middle::ty::query::Providers;
6868
use rustc_middle::ty::TyCtxt;
6969
use rustc_session::lint::builtin::{
70-
AUTOMATIC_LINKS, BARE_TRAIT_OBJECTS, BROKEN_INTRA_DOC_LINKS, ELIDED_LIFETIMES_IN_PATHS,
70+
BARE_TRAIT_OBJECTS, BROKEN_INTRA_DOC_LINKS, ELIDED_LIFETIMES_IN_PATHS,
7171
EXPLICIT_OUTLIVES_REQUIREMENTS, INVALID_CODEBLOCK_ATTRIBUTES, INVALID_HTML_TAGS,
72-
MISSING_DOC_CODE_EXAMPLES, PRIVATE_DOC_TESTS,
72+
MISSING_DOC_CODE_EXAMPLES, PRIVATE_DOC_TESTS, URL_IMPROVEMENTS,
7373
};
7474
use rustc_span::symbol::{Ident, Symbol};
7575
use rustc_span::Span;
@@ -313,7 +313,7 @@ fn register_builtins(store: &mut LintStore, no_interleave_lints: bool) {
313313

314314
add_lint_group!(
315315
"rustdoc",
316-
AUTOMATIC_LINKS,
316+
URL_IMPROVEMENTS,
317317
BROKEN_INTRA_DOC_LINKS,
318318
PRIVATE_INTRA_DOC_LINKS,
319319
INVALID_CODEBLOCK_ATTRIBUTES,

compiler/rustc_lint_defs/src/builtin.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1891,12 +1891,12 @@ declare_lint! {
18911891
}
18921892

18931893
declare_lint! {
1894-
/// The `automatic_links` lint detects when a URL could be written using
1894+
/// The `url_improvements` lint detects when a URL could be written using
18951895
/// only angle brackets. This is a `rustdoc` only lint, see the
18961896
/// documentation in the [rustdoc book].
18971897
///
1898-
/// [rustdoc book]: ../../../rustdoc/lints.html#automatic_links
1899-
pub AUTOMATIC_LINKS,
1898+
/// [rustdoc book]: ../../../rustdoc/lints.html#url_improvements
1899+
pub URL_IMPROVEMENTS,
19001900
Warn,
19011901
"detects URLs that could be written using only angle brackets"
19021902
}
@@ -2806,7 +2806,7 @@ declare_lint_pass! {
28062806
MISSING_DOC_CODE_EXAMPLES,
28072807
INVALID_HTML_TAGS,
28082808
PRIVATE_DOC_TESTS,
2809-
AUTOMATIC_LINKS,
2809+
URL_IMPROVEMENTS,
28102810
WHERE_CLAUSES_OBJECT_SAFETY,
28112811
PROC_MACRO_DERIVE_RESOLUTION_FALLBACK,
28122812
MACRO_USE_EXTERN_CRATE,

library/core/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ pub mod primitive;
287287
unused_imports,
288288
unsafe_op_in_unsafe_fn
289289
)]
290-
#[cfg_attr(not(bootstrap), allow(automatic_links))]
290+
#[cfg_attr(not(bootstrap), allow(url_improvements))]
291291
// FIXME: This annotation should be moved into rust-lang/stdarch after clashing_extern_declarations is
292292
// merged. It currently cannot because bootstrap fails as the lint hasn't been defined yet.
293293
#[allow(clashing_extern_declarations)]

src/doc/rustdoc/src/lints.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ warning: unclosed HTML tag `h1`
286286
warning: 2 warnings emitted
287287
```
288288

289-
## automatic_links
289+
## url_improvements
290290

291291
This lint is **nightly-only** and **warns by default**. It detects links which
292292
could use the "automatic" link syntax. For example:

src/librustdoc/core.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,13 +330,12 @@ pub fn run_core(
330330
let invalid_codeblock_attributes_name = rustc_lint::builtin::INVALID_CODEBLOCK_ATTRIBUTES.name;
331331
let invalid_html_tags = rustc_lint::builtin::INVALID_HTML_TAGS.name;
332332
let renamed_and_removed_lints = rustc_lint::builtin::RENAMED_AND_REMOVED_LINTS.name;
333-
let automatic_links = rustc_lint::builtin::AUTOMATIC_LINKS.name;
333+
let url_improvements = rustc_lint::builtin::URL_IMPROVEMENTS.name;
334334
let unknown_lints = rustc_lint::builtin::UNKNOWN_LINTS.name;
335335

336336
// In addition to those specific lints, we also need to allow those given through
337337
// command line, otherwise they'll get ignored and we don't want that.
338338
let lints_to_show = vec![
339-
automatic_links.to_owned(),
340339
intra_link_resolution_failure_name.to_owned(),
341340
missing_docs.to_owned(),
342341
missing_doc_example.to_owned(),
@@ -346,6 +345,7 @@ pub fn run_core(
346345
invalid_html_tags.to_owned(),
347346
renamed_and_removed_lints.to_owned(),
348347
unknown_lints.to_owned(),
348+
url_improvements.to_owned(),
349349
];
350350

351351
let (lint_opts, lint_caps) = init_lints(lints_to_show, lint_opts, |lint| {

src/librustdoc/passes/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ use crate::core::DocContext;
1111
mod stripper;
1212
pub use stripper::*;
1313

14-
mod automatic_links;
15-
pub use self::automatic_links::CHECK_AUTOMATIC_LINKS;
14+
mod url_improvements;
15+
pub use self::url_improvements::CHECK_URL_IMPROVEMENTS;
1616

1717
mod collapse_docs;
1818
pub use self::collapse_docs::COLLAPSE_DOCS;
@@ -93,7 +93,7 @@ pub const PASSES: &[Pass] = &[
9393
COLLECT_TRAIT_IMPLS,
9494
CALCULATE_DOC_COVERAGE,
9595
CHECK_INVALID_HTML_TAGS,
96-
CHECK_AUTOMATIC_LINKS,
96+
CHECK_URL_IMPROVEMENTS,
9797
];
9898

9999
/// The list of passes run by default.
@@ -109,7 +109,7 @@ pub const DEFAULT_PASSES: &[ConditionalPass] = &[
109109
ConditionalPass::always(CHECK_CODE_BLOCK_SYNTAX),
110110
ConditionalPass::always(CHECK_INVALID_HTML_TAGS),
111111
ConditionalPass::always(PROPAGATE_DOC_CFG),
112-
ConditionalPass::always(CHECK_AUTOMATIC_LINKS),
112+
ConditionalPass::always(CHECK_URL_IMPROVEMENTS),
113113
];
114114

115115
/// The list of default passes run when `--doc-coverage` is passed to rustdoc.

src/librustdoc/passes/automatic_links.rs renamed to src/librustdoc/passes/url_improvements.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ use rustc_errors::Applicability;
1010
use rustc_feature::UnstableFeatures;
1111
use rustc_session::lint;
1212

13-
pub const CHECK_AUTOMATIC_LINKS: Pass = Pass {
14-
name: "check-automatic-links",
15-
run: check_automatic_links,
13+
pub const CHECK_URL_IMPROVEMENTS: Pass = Pass {
14+
name: "check-url-improvements",
15+
run: check_url_improvements,
1616
description: "detects URLS that could be written using angle brackets",
1717
};
1818

@@ -23,14 +23,14 @@ const URL_REGEX: &str = concat!(
2323
r"\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)" // optional query or url fragments
2424
);
2525

26-
struct AutomaticLinksLinter<'a, 'tcx> {
26+
struct UrlImprovementsLinter<'a, 'tcx> {
2727
cx: &'a DocContext<'tcx>,
2828
regex: Regex,
2929
}
3030

31-
impl<'a, 'tcx> AutomaticLinksLinter<'a, 'tcx> {
31+
impl<'a, 'tcx> UrlImprovementsLinter<'a, 'tcx> {
3232
fn new(cx: &'a DocContext<'tcx>) -> Self {
33-
AutomaticLinksLinter { cx, regex: Regex::new(URL_REGEX).expect("failed to build regex") }
33+
UrlImprovementsLinter { cx, regex: Regex::new(URL_REGEX).expect("failed to build regex") }
3434
}
3535

3636
fn find_raw_urls(
@@ -53,17 +53,17 @@ impl<'a, 'tcx> AutomaticLinksLinter<'a, 'tcx> {
5353
}
5454
}
5555

56-
pub fn check_automatic_links(krate: Crate, cx: &DocContext<'_>) -> Crate {
56+
pub fn check_url_improvements(krate: Crate, cx: &DocContext<'_>) -> Crate {
5757
if !UnstableFeatures::from_environment().is_nightly_build() {
5858
krate
5959
} else {
60-
let mut coll = AutomaticLinksLinter::new(cx);
60+
let mut coll = UrlImprovementsLinter::new(cx);
6161

6262
coll.fold_crate(krate)
6363
}
6464
}
6565

66-
impl<'a, 'tcx> DocFolder for AutomaticLinksLinter<'a, 'tcx> {
66+
impl<'a, 'tcx> DocFolder for UrlImprovementsLinter<'a, 'tcx> {
6767
fn fold_item(&mut self, item: Item) -> Option<Item> {
6868
let hir_id = match self.cx.as_local_hir_id(item.def_id) {
6969
Some(hir_id) => hir_id,
@@ -78,7 +78,7 @@ impl<'a, 'tcx> DocFolder for AutomaticLinksLinter<'a, 'tcx> {
7878
let sp = super::source_span_for_markdown_range(cx, &dox, &range, &item.attrs)
7979
.or_else(|| span_of_attrs(&item.attrs))
8080
.unwrap_or(item.source.span());
81-
cx.tcx.struct_span_lint_hir(lint::builtin::AUTOMATIC_LINKS, hir_id, sp, |lint| {
81+
cx.tcx.struct_span_lint_hir(lint::builtin::URL_IMPROVEMENTS, hir_id, sp, |lint| {
8282
lint.build(msg)
8383
.span_suggestion(
8484
sp,

src/test/rustdoc-ui/automatic-links.rs renamed to src/test/rustdoc-ui/url-improvements.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![deny(automatic_links)]
1+
#![deny(url_improvements)]
22

33
/// [http://a.com](http://a.com)
44
//~^ ERROR unneeded long form for URL
@@ -53,7 +53,7 @@ pub fn c() {}
5353
/// [b]: http://b.com
5454
pub fn everything_is_fine_here() {}
5555

56-
#[allow(automatic_links)]
56+
#[allow(url_improvements)]
5757
pub mod foo {
5858
/// https://somewhere.com/a?hello=12&bye=11#xyz
5959
pub fn bar() {}

src/test/rustdoc-ui/automatic-links.stderr renamed to src/test/rustdoc-ui/url-improvements.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ LL | /// [http://a.com](http://a.com)
77
note: the lint level is defined here
88
--> $DIR/automatic-links.rs:1:9
99
|
10-
LL | #![deny(automatic_links)]
11-
| ^^^^^^^^^^^^^^^
10+
LL | #![deny(url_improvements)]
11+
| ^^^^^^^^^^^^^^^^
1212

1313
error: unneeded long form for URL
1414
--> $DIR/automatic-links.rs:5:5

0 commit comments

Comments
 (0)