summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui-toml/private-doc-errors/doc_lints.rs
blob: ae4c3f84c29662c2973e0ad4129bf664f448f1ce (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
43
44
45
46
47
48
49
50
51
52
53
54
#![deny(
    clippy::unnecessary_safety_doc,
    clippy::missing_errors_doc,
    clippy::missing_panics_doc
)]

/// This is a private function, skip to match behavior with `missing_safety_doc`.
///
/// # Safety
///
/// Boo!
fn you_dont_see_me() {
    //~^ ERROR: safe function's docs have unnecessary `# Safety` section
    unimplemented!();
}

mod private_mod {
    /// This is public but unexported function.
    ///
    /// # Safety
    ///
    /// Very safe!
    pub fn only_crate_wide_accessible() -> Result<(), ()> {
        //~^ ERROR: safe function's docs have unnecessary `# Safety` section
        //~| ERROR: docs for function returning `Result` missing `# Errors` section
        unimplemented!();
    }
}

pub struct S;

impl S {
    /// Private, fine again to stay consistent with `missing_safety_doc`.
    ///
    /// # Safety
    ///
    /// Unnecessary!
    fn private(&self) {
        //~^ ERROR: safe function's docs have unnecessary `# Safety` section
        //~| ERROR: docs for function which may panic missing `# Panics` section
        panic!();
    }
}

#[doc(hidden)]
pub mod __macro {
    pub struct T;
    impl T {
        pub unsafe fn f() {}
        //~^ ERROR: unsafe function's docs miss `# Safety` section
    }
}

fn main() {}