diff options
Diffstat (limited to 'src/tools/clippy/src/docs/unit_return_expecting_ord.txt')
-rw-r--r-- | src/tools/clippy/src/docs/unit_return_expecting_ord.txt | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/unit_return_expecting_ord.txt b/src/tools/clippy/src/docs/unit_return_expecting_ord.txt new file mode 100644 index 000000000..781feac5a --- /dev/null +++ b/src/tools/clippy/src/docs/unit_return_expecting_ord.txt @@ -0,0 +1,20 @@ +### What it does +Checks for functions that expect closures of type +Fn(...) -> Ord where the implemented closure returns the unit type. +The lint also suggests to remove the semi-colon at the end of the statement if present. + +### Why is this bad? +Likely, returning the unit type is unintentional, and +could simply be caused by an extra semi-colon. Since () implements Ord +it doesn't cause a compilation error. +This is the same reasoning behind the unit_cmp lint. + +### Known problems +If returning unit is intentional, then there is no +way of specifying this without triggering needless_return lint + +### Example +``` +let mut twins = vec!((1, 1), (2, 2)); +twins.sort_by_key(|x| { x.1; }); +```
\ No newline at end of file |