]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/src/docs/unit_return_expecting_ord.txt
Merge commit 'b52fb5234cd7c11ecfae51897a6f7fa52e8777fc' into clippyup
[rust.git] / src / tools / clippy / src / docs / unit_return_expecting_ord.txt
1 ### What it does
2 Checks for functions that expect closures of type
3 Fn(...) -> Ord where the implemented closure returns the unit type.
4 The lint also suggests to remove the semi-colon at the end of the statement if present.
5
6 ### Why is this bad?
7 Likely, returning the unit type is unintentional, and
8 could simply be caused by an extra semi-colon. Since () implements Ord
9 it doesn't cause a compilation error.
10 This is the same reasoning behind the unit_cmp lint.
11
12 ### Known problems
13 If returning unit is intentional, then there is no
14 way of specifying this without triggering needless_return lint
15
16 ### Example
17 ```
18 let mut twins = vec!((1, 1), (2, 2));
19 twins.sort_by_key(|x| { x.1; });
20 ```