summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/missing_safety_doc.txt
blob: 6492eb84f63bf7328cd13496e0fcd5c98fca86e2 (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
### What it does
Checks for the doc comments of publicly visible
unsafe functions and warns if there is no `# Safety` section.

### Why is this bad?
Unsafe functions should document their safety
preconditions, so that users can be sure they are using them safely.

### Examples
```
/// This function should really be documented
pub unsafe fn start_apocalypse(u: &mut Universe) {
    unimplemented!();
}
```

At least write a line about safety:

```
/// # Safety
///
/// This function should not be called before the horsemen are ready.
pub unsafe fn start_apocalypse(u: &mut Universe) {
    unimplemented!();
}
```