]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/src/docs/missing_safety_doc.txt
Rollup merge of #101578 - lcnr:resolve-hack, r=jackh726
[rust.git] / src / tools / clippy / src / docs / missing_safety_doc.txt
1 ### What it does
2 Checks for the doc comments of publicly visible
3 unsafe functions and warns if there is no `# Safety` section.
4
5 ### Why is this bad?
6 Unsafe functions should document their safety
7 preconditions, so that users can be sure they are using them safely.
8
9 ### Examples
10 ```
11 /// This function should really be documented
12 pub unsafe fn start_apocalypse(u: &mut Universe) {
13     unimplemented!();
14 }
15 ```
16
17 At least write a line about safety:
18
19 ```
20 /// # Safety
21 ///
22 /// This function should not be called before the horsemen are ready.
23 pub unsafe fn start_apocalypse(u: &mut Universe) {
24     unimplemented!();
25 }
26 ```