diff options
| author | Kyle Lin <minecraft.kyle.train@gmail.com> | 2023-06-30 18:10:01 +0800 |
|---|---|---|
| committer | Kyle Lin <minecraft.kyle.train@gmail.com> | 2023-08-18 15:19:15 +0800 |
| commit | c7369891ba3265e47346bf44d6f5b5bf4451f3ca (patch) | |
| tree | 38085c48a7c3a7cba9c17f706f752788746d52cf /tests/rustdoc-ui/lints | |
| parent | e583318aa864ce0a3d53c339600d51a70d7b6440 (diff) | |
| download | rust-c7369891ba3265e47346bf44d6f5b5bf4451f3ca.tar.gz rust-c7369891ba3265e47346bf44d6f5b5bf4451f3ca.zip | |
Refactor lint from rustc to rustdoc
Diffstat (limited to 'tests/rustdoc-ui/lints')
| -rw-r--r-- | tests/rustdoc-ui/lints/redundant_explicit_links.fixed | 54 | ||||
| -rw-r--r-- | tests/rustdoc-ui/lints/redundant_explicit_links.rs | 29 | ||||
| -rw-r--r-- | tests/rustdoc-ui/lints/redundant_explicit_links.stderr | 318 |
3 files changed, 327 insertions, 74 deletions
diff --git a/tests/rustdoc-ui/lints/redundant_explicit_links.fixed b/tests/rustdoc-ui/lints/redundant_explicit_links.fixed new file mode 100644 index 00000000000..6759ee10049 --- /dev/null +++ b/tests/rustdoc-ui/lints/redundant_explicit_links.fixed @@ -0,0 +1,54 @@ +// run-rustfix + +#![deny(rustdoc::redundant_explicit_links)] + +pub fn dummy_target() {} + +/// [dummy_target] +//~^ ERROR redundant explicit link target +/// [`dummy_target`] +//~^ ERROR redundant explicit link target +/// +/// [Vec] +//~^ ERROR redundant explicit link target +/// [`Vec`] +//~^ ERROR redundant explicit link target +/// [Vec] +//~^ ERROR redundant explicit link target +/// [`Vec`] +//~^ ERROR redundant explicit link target +/// [std::vec::Vec] +//~^ ERROR redundant explicit link target +/// [`std::vec::Vec`] +//~^ ERROR redundant explicit link target +/// [std::vec::Vec] +//~^ ERROR redundant explicit link target +/// [`std::vec::Vec`] +//~^ ERROR redundant explicit link target +/// +/// [usize] +//~^ ERROR redundant explicit link target +/// [`usize`] +//~^ ERROR redundant explicit link target +/// [usize] +//~^ ERROR redundant explicit link target +/// [`usize`] +//~^ ERROR redundant explicit link target +/// [std::primitive::usize] +//~^ ERROR redundant explicit link target +/// [`std::primitive::usize`] +//~^ ERROR redundant explicit link target +/// [std::primitive::usize] +//~^ ERROR redundant explicit link target +/// [`std::primitive::usize`] +//~^ ERROR redundant explicit link target +/// +/// [dummy_target] TEXT +//~^ ERROR redundant explicit link target +/// [`dummy_target`] TEXT +//~^ ERROR redundant explicit link target +pub fn should_warn_inline() {} + +/// [`Vec<T>`](Vec) +/// [`Vec<T>`](std::vec::Vec) +pub fn should_not_warn_inline() {} diff --git a/tests/rustdoc-ui/lints/redundant_explicit_links.rs b/tests/rustdoc-ui/lints/redundant_explicit_links.rs index b3203a2690f..7c30b15d993 100644 --- a/tests/rustdoc-ui/lints/redundant_explicit_links.rs +++ b/tests/rustdoc-ui/lints/redundant_explicit_links.rs @@ -1,29 +1,54 @@ +// run-rustfix + #![deny(rustdoc::redundant_explicit_links)] pub fn dummy_target() {} /// [dummy_target](dummy_target) +//~^ ERROR redundant explicit link target /// [`dummy_target`](dummy_target) +//~^ ERROR redundant explicit link target /// /// [Vec](Vec) +//~^ ERROR redundant explicit link target /// [`Vec`](Vec) +//~^ ERROR redundant explicit link target /// [Vec](std::vec::Vec) +//~^ ERROR redundant explicit link target /// [`Vec`](std::vec::Vec) +//~^ ERROR redundant explicit link target /// [std::vec::Vec](Vec) +//~^ ERROR redundant explicit link target /// [`std::vec::Vec`](Vec) +//~^ ERROR redundant explicit link target /// [std::vec::Vec](std::vec::Vec) +//~^ ERROR redundant explicit link target /// [`std::vec::Vec`](std::vec::Vec) +//~^ ERROR redundant explicit link target /// /// [usize](usize) +//~^ ERROR redundant explicit link target /// [`usize`](usize) +//~^ ERROR redundant explicit link target /// [usize](std::primitive::usize) +//~^ ERROR redundant explicit link target /// [`usize`](std::primitive::usize) +//~^ ERROR redundant explicit link target /// [std::primitive::usize](usize) +//~^ ERROR redundant explicit link target /// [`std::primitive::usize`](usize) +//~^ ERROR redundant explicit link target /// [std::primitive::usize](std::primitive::usize) +//~^ ERROR redundant explicit link target /// [`std::primitive::usize`](std::primitive::usize) -pub fn should_warn() {} +//~^ ERROR redundant explicit link target +/// +/// [dummy_target](dummy_target) TEXT +//~^ ERROR redundant explicit link target +/// [`dummy_target`](dummy_target) TEXT +//~^ ERROR redundant explicit link target +pub fn should_warn_inline() {} /// [`Vec<T>`](Vec) /// [`Vec<T>`](std::vec::Vec) -pub fn should_not_warn() {} +pub fn should_not_warn_inline() {} diff --git a/tests/rustdoc-ui/lints/redundant_explicit_links.stderr b/tests/rustdoc-ui/lints/redundant_explicit_links.stderr index e72105f394f..3f10a2e662d 100644 --- a/tests/rustdoc-ui/lints/redundant_explicit_links.stderr +++ b/tests/rustdoc-ui/lints/redundant_explicit_links.stderr @@ -1,133 +1,307 @@ -error: redundant explicit rustdoc link - --> $DIR/redundant_explicit_links.rs:5:20 +error: redundant explicit link target + --> $DIR/redundant_explicit_links.rs:7:20 | LL | /// [dummy_target](dummy_target) - | ^^^^^^^^^^^^ + | ------------ ^^^^^^^^^^^^ explicit target is redundant + | | + | because label contains path that resolves to same destination | - = note: Explicit link does not affect the original link + = note: when a link's destination is not specified, + the label is used to resolve intra-doc links note: the lint level is defined here - --> $DIR/redundant_explicit_links.rs:1:9 + --> $DIR/redundant_explicit_links.rs:3:9 | LL | #![deny(rustdoc::redundant_explicit_links)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = help: Remove explicit link instead +help: remove explicit link target + | +LL | /// [dummy_target] + | ~~~~~~~~~~~~~~ -error: redundant explicit rustdoc link - --> $DIR/redundant_explicit_links.rs:6:22 +error: redundant explicit link target + --> $DIR/redundant_explicit_links.rs:9:22 | LL | /// [`dummy_target`](dummy_target) - | ^^^^^^^^^^^^ + | -------------- ^^^^^^^^^^^^ explicit target is redundant + | | + | because label contains path that resolves to same destination + | + = note: when a link's destination is not specified, + the label is used to resolve intra-doc links +help: remove explicit link target | - = note: Explicit link does not affect the original link - = help: Remove explicit link instead +LL | /// [`dummy_target`] + | ~~~~~~~~~~~~~~~~ -error: redundant explicit rustdoc link - --> $DIR/redundant_explicit_links.rs:8:11 +error: redundant explicit link target + --> $DIR/redundant_explicit_links.rs:12:11 | LL | /// [Vec](Vec) - | ^^^ + | --- ^^^ explicit target is redundant + | | + | because label contains path that resolves to same destination + | + = note: when a link's destination is not specified, + the label is used to resolve intra-doc links +help: remove explicit link target | - = note: Explicit link does not affect the original link - = help: Remove explicit link instead +LL | /// [Vec] + | ~~~~~ -error: redundant explicit rustdoc link - --> $DIR/redundant_explicit_links.rs:9:13 +error: redundant explicit link target + --> $DIR/redundant_explicit_links.rs:14:13 | LL | /// [`Vec`](Vec) - | ^^^ + | ----- ^^^ explicit target is redundant + | | + | because label contains path that resolves to same destination | - = note: Explicit link does not affect the original link - = help: Remove explicit link instead + = note: when a link's destination is not specified, + the label is used to resolve intra-doc links +help: remove explicit link target + | +LL | /// [`Vec`] + | ~~~~~~~ -error: redundant explicit rustdoc link - --> $DIR/redundant_explicit_links.rs:10:11 +error: redundant explicit link target + --> $DIR/redundant_explicit_links.rs:16:11 | LL | /// [Vec](std::vec::Vec) - | ^^^^^^^^^^^^^ + | --- ^^^^^^^^^^^^^ explicit target is redundant + | | + | because label contains path that resolves to same destination + | + = note: when a link's destination is not specified, + the label is used to resolve intra-doc links +help: remove explicit link target | - = note: Explicit link does not affect the original link - = help: Remove explicit link instead +LL | /// [Vec] + | ~~~~~ -error: redundant explicit rustdoc link - --> $DIR/redundant_explicit_links.rs:11:13 +error: redundant explicit link target + --> $DIR/redundant_explicit_links.rs:18:13 | LL | /// [`Vec`](std::vec::Vec) - | ^^^^^^^^^^^^^ + | ----- ^^^^^^^^^^^^^ explicit target is redundant + | | + | because label contains path that resolves to same destination + | + = note: when a link's destination is not specified, + the label is used to resolve intra-doc links +help: remove explicit link target + | +LL | /// [`Vec`] + | ~~~~~~~ + +error: redundant explicit link target + --> $DIR/redundant_explicit_links.rs:20:21 + | +LL | /// [std::vec::Vec](Vec) + | ------------- ^^^ explicit target is redundant + | | + | because label contains path that resolves to same destination + | + = note: when a link's destination is not specified, + the label is used to resolve intra-doc links +help: remove explicit link target | - = note: Explicit link does not affect the original link - = help: Remove explicit link instead +LL | /// [std::vec::Vec] + | ~~~~~~~~~~~~~~~ -error: redundant explicit rustdoc link - --> $DIR/redundant_explicit_links.rs:14:21 +error: redundant explicit link target + --> $DIR/redundant_explicit_links.rs:22:23 + | +LL | /// [`std::vec::Vec`](Vec) + | --------------- ^^^ explicit target is redundant + | | + | because label contains path that resolves to same destination + | + = note: when a link's destination is not specified, + the label is used to resolve intra-doc links +help: remove explicit link target + | +LL | /// [`std::vec::Vec`] + | ~~~~~~~~~~~~~~~~~ + +error: redundant explicit link target + --> $DIR/redundant_explicit_links.rs:24:21 | LL | /// [std::vec::Vec](std::vec::Vec) - | ^^^^^^^^^^^^^ + | ------------- ^^^^^^^^^^^^^ explicit target is redundant + | | + | because label contains path that resolves to same destination + | + = note: when a link's destination is not specified, + the label is used to resolve intra-doc links +help: remove explicit link target | - = note: Explicit link does not affect the original link - = help: Remove explicit link instead +LL | /// [std::vec::Vec] + | ~~~~~~~~~~~~~~~ -error: redundant explicit rustdoc link - --> $DIR/redundant_explicit_links.rs:15:23 +error: redundant explicit link target + --> $DIR/redundant_explicit_links.rs:26:23 | LL | /// [`std::vec::Vec`](std::vec::Vec) - | ^^^^^^^^^^^^^ + | --------------- ^^^^^^^^^^^^^ explicit target is redundant + | | + | because label contains path that resolves to same destination | - = note: Explicit link does not affect the original link - = help: Remove explicit link instead + = note: when a link's destination is not specified, + the label is used to resolve intra-doc links +help: remove explicit link target + | +LL | /// [`std::vec::Vec`] + | ~~~~~~~~~~~~~~~~~ -error: redundant explicit rustdoc link - --> $DIR/redundant_explicit_links.rs:17:13 +error: redundant explicit link target + --> $DIR/redundant_explicit_links.rs:29:13 | LL | /// [usize](usize) - | ^^^^^ + | ----- ^^^^^ explicit target is redundant + | | + | because label contains path that resolves to same destination + | + = note: when a link's destination is not specified, + the label is used to resolve intra-doc links +help: remove explicit link target | - = note: Explicit link does not affect the original link - = help: Remove explicit link instead +LL | /// [usize] + | ~~~~~~~ -error: redundant explicit rustdoc link - --> $DIR/redundant_explicit_links.rs:18:15 +error: redundant explicit link target + --> $DIR/redundant_explicit_links.rs:31:15 | LL | /// [`usize`](usize) - | ^^^^^ + | ------- ^^^^^ explicit target is redundant + | | + | because label contains path that resolves to same destination | - = note: Explicit link does not affect the original link - = help: Remove explicit link instead + = note: when a link's destination is not specified, + the label is used to resolve intra-doc links +help: remove explicit link target + | +LL | /// [`usize`] + | ~~~~~~~~~ -error: redundant explicit rustdoc link - --> $DIR/redundant_explicit_links.rs:19:13 +error: redundant explicit link target + --> $DIR/redundant_explicit_links.rs:33:13 | LL | /// [usize](std::primitive::usize) - | ^^^^^^^^^^^^^^^^^^^^^ + | ----- ^^^^^^^^^^^^^^^^^^^^^ explicit target is redundant + | | + | because label contains path that resolves to same destination + | + = note: when a link's destination is not specified, + the label is used to resolve intra-doc links +help: remove explicit link target | - = note: Explicit link does not affect the original link - = help: Remove explicit link instead +LL | /// [usize] + | ~~~~~~~ -error: redundant explicit rustdoc link - --> $DIR/redundant_explicit_links.rs:20:15 +error: redundant explicit link target + --> $DIR/redundant_explicit_links.rs:35:15 | LL | /// [`usize`](std::primitive::usize) - | ^^^^^^^^^^^^^^^^^^^^^ + | ------- ^^^^^^^^^^^^^^^^^^^^^ explicit target is redundant + | | + | because label contains path that resolves to same destination | - = note: Explicit link does not affect the original link - = help: Remove explicit link instead + = note: when a link's destination is not specified, + the label is used to resolve intra-doc links +help: remove explicit link target + | +LL | /// [`usize`] + | ~~~~~~~~~ + +error: redundant explicit link target + --> $DIR/redundant_explicit_links.rs:37:29 + | +LL | /// [std::primitive::usize](usize) + | --------------------- ^^^^^ explicit target is redundant + | | + | because label contains path that resolves to same destination + | + = note: when a link's destination is not specified, + the label is used to resolve intra-doc links +help: remove explicit link target + | +LL | /// [std::primitive::usize] + | ~~~~~~~~~~~~~~~~~~~~~~~ -error: redundant explicit rustdoc link - --> $DIR/redundant_explicit_links.rs:23:29 +error: redundant explicit link target + --> $DIR/redundant_explicit_links.rs:39:31 + | +LL | /// [`std::primitive::usize`](usize) + | ----------------------- ^^^^^ explicit target is redundant + | | + | because label contains path that resolves to same destination + | + = note: when a link's destination is not specified, + the label is used to resolve intra-doc links +help: remove explicit link target + | +LL | /// [`std::primitive::usize`] + | ~~~~~~~~~~~~~~~~~~~~~~~~~ + +error: redundant explicit link target + --> $DIR/redundant_explicit_links.rs:41:29 | LL | /// [std::primitive::usize](std::primitive::usize) - | ^^^^^^^^^^^^^^^^^^^^^ + | --------------------- ^^^^^^^^^^^^^^^^^^^^^ explicit target is redundant + | | + | because label contains path that resolves to same destination + | + = note: when a link's destination is not specified, + the label is used to resolve intra-doc links +help: remove explicit link target | - = note: Explicit link does not affect the original link - = help: Remove explicit link instead +LL | /// [std::primitive::usize] + | ~~~~~~~~~~~~~~~~~~~~~~~ -error: redundant explicit rustdoc link - --> $DIR/redundant_explicit_links.rs:24:31 +error: redundant explicit link target + --> $DIR/redundant_explicit_links.rs:43:31 | LL | /// [`std::primitive::usize`](std::primitive::usize) - | ^^^^^^^^^^^^^^^^^^^^^ + | ----------------------- ^^^^^^^^^^^^^^^^^^^^^ explicit target is redundant + | | + | because label contains path that resolves to same destination + | + = note: when a link's destination is not specified, + the label is used to resolve intra-doc links +help: remove explicit link target + | +LL | /// [`std::primitive::usize`] + | ~~~~~~~~~~~~~~~~~~~~~~~~~ + +error: redundant explicit link target + --> $DIR/redundant_explicit_links.rs:46:20 + | +LL | /// [dummy_target](dummy_target) TEXT + | ------------ ^^^^^^^^^^^^ explicit target is redundant + | | + | because label contains path that resolves to same destination + | + = note: when a link's destination is not specified, + the label is used to resolve intra-doc links +help: remove explicit link target + | +LL | /// [dummy_target] TEXT + | ~~~~~~~~~~~~~~ + +error: redundant explicit link target + --> $DIR/redundant_explicit_links.rs:48:22 + | +LL | /// [`dummy_target`](dummy_target) TEXT + | -------------- ^^^^^^^^^^^^ explicit target is redundant + | | + | because label contains path that resolves to same destination + | + = note: when a link's destination is not specified, + the label is used to resolve intra-doc links +help: remove explicit link target | - = note: Explicit link does not affect the original link - = help: Remove explicit link instead +LL | /// [`dummy_target`] TEXT + | ~~~~~~~~~~~~~~~~ -error: aborting due to 14 previous errors +error: aborting due to 20 previous errors |
