Files
rust/tests/ui/doc/link_adjacent.fixed
Michael Howell 045e36d6a7 doc_link_code: add check for text[adjacent] style links
This is the lint described at
https://github.com/rust-lang/rust/pull/136308#issuecomment-2625485331
that recommends using HTML to nest links inside code.
2025-01-30 16:10:05 -07:00

53 lines
1.3 KiB
Rust

#![warn(clippy::doc_link_code)]
//! Test case for code links that are adjacent to code text.
//!
//! This is not an example: `first``second`
//!
//! Neither is this: [`first`](x)
//!
//! Neither is this: [`first`](x) `second`
//!
//! Neither is this: [first](x)`second`
//!
//! This is: <code>[first](x)second</code>
//~^ ERROR: adjacent
//!
//! So is this <code>first[second](x)</code>
//~^ ERROR: adjacent
//!
//! So is this <code>[first](x)[second](x)</code>
//~^ ERROR: adjacent
//!
//! So is this <code>[first](x)[second](x)[third](x)</code>
//~^ ERROR: adjacent
//!
//! So is this <code>[first](x)second[third](x)</code>
//~^ ERROR: adjacent
/// Test case for code links that are adjacent to code text.
///
/// This is not an example: `first``second` arst
///
/// Neither is this: [`first`](x) arst
///
/// Neither is this: [`first`](x) `second` arst
///
/// Neither is this: [first](x)`second` arst
///
/// This is: <code>[first](x)second</code> arst
//~^ ERROR: adjacent
///
/// So is this <code>first[second](x)</code> arst
//~^ ERROR: adjacent
///
/// So is this <code>[first](x)[second](x)</code> arst
//~^ ERROR: adjacent
///
/// So is this <code>[first](x)[second](x)[third](x)</code> arst
//~^ ERROR: adjacent
///
/// So is this <code>[first](x)second[third](x)</code> arst
//~^ ERROR: adjacent
pub struct WithTrailing;