]> git.lizzy.rs Git - rust.git/blob - src/docs/needless_doctest_main.txt
Add iter_kv_map lint
[rust.git] / src / docs / needless_doctest_main.txt
1 ### What it does
2 Checks for `fn main() { .. }` in doctests
3
4 ### Why is this bad?
5 The test can be shorter (and likely more readable)
6 if the `fn main()` is left implicit.
7
8 ### Examples
9 ```
10 /// An example of a doctest with a `main()` function
11 ///
12 /// # Examples
13 ///
14 /// ```
15 /// fn main() {
16 ///     // this needs not be in an `fn`
17 /// }
18 /// ```
19 fn needless_main() {
20     unimplemented!();
21 }
22 ```