about summary refs log tree commit diff
path: root/src/tools/clippy/tests/ui/doc/doc_include_without_cfg.fixed
blob: a05954adf5a535a22be770518fe3cc90ef4d43f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#![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
}