]> git.lizzy.rs Git - rust.git/blob - src/docs/unused_unit.txt
Auto merge of #9421 - xphoniex:fix-#9420, r=giraffate
[rust.git] / src / docs / unused_unit.txt
1 ### What it does
2 Checks for unit (`()`) expressions that can be removed.
3
4 ### Why is this bad?
5 Such expressions add no value, but can make the code
6 less readable. Depending on formatting they can make a `break` or `return`
7 statement look like a function call.
8
9 ### Example
10 ```
11 fn return_unit() -> () {
12     ()
13 }
14 ```
15 is equivalent to
16 ```
17 fn return_unit() {}
18 ```