]> git.lizzy.rs Git - rust.git/blob - src/docs/missing_panics_doc.txt
Add iter_kv_map lint
[rust.git] / src / docs / missing_panics_doc.txt
1 ### What it does
2 Checks the doc comments of publicly visible functions that
3 may panic and warns if there is no `# Panics` section.
4
5 ### Why is this bad?
6 Documenting the scenarios in which panicking occurs
7 can help callers who do not want to panic to avoid those situations.
8
9 ### Examples
10 Since the following function may panic it has a `# Panics` section in
11 its doc comment:
12
13 ```
14 /// # Panics
15 ///
16 /// Will panic if y is 0
17 pub fn divide_by(x: i32, y: i32) -> i32 {
18     if y == 0 {
19         panic!("Cannot divide by 0")
20     } else {
21         x / y
22     }
23 }
24 ```