rust/tests/ui/doc/doc_include_without_cfg.fixed
2024-11-21 22:43:55 +01:00

40 lines
1 KiB
Rust

#![warn(clippy::doc_include_without_cfg)]
// Should not lint.
#![doc(html_playground_url = "https://playground.example.com/")]
#![cfg_attr(doc, doc = include_str!("../approx_const.rs"))] //~ doc_include_without_cfg
// Should not lint.
#![cfg_attr(feature = "whatever", doc = include_str!("../approx_const.rs"))]
#![cfg_attr(doc, doc = include_str!("../approx_const.rs"))]
#![doc = "some doc"]
//! more doc
macro_rules! man_link {
($a:literal, $b:literal) => {
concat!($a, $b)
};
}
// Should not lint!
macro_rules! tst {
($(#[$attr:meta])*) => {
$(#[$attr])*
fn blue() {
println!("Hello, world!");
}
}
}
tst! {
/// This is a test with no included file
}
#[cfg_attr(doc, doc = include_str!("../approx_const.rs"))] //~ doc_include_without_cfg
// Should not lint.
#[doc = man_link!("bla", "blob")]
#[cfg_attr(feature = "whatever", doc = include_str!("../approx_const.rs"))]
#[cfg_attr(doc, doc = include_str!("../approx_const.rs"))]
#[doc = "some doc"]
/// more doc
fn main() {
// test code goes here
}