]> git.lizzy.rs Git - rust.git/blob - src/docs/redundant_closure_for_method_calls.txt
[Arithmetic] Consider literals
[rust.git] / src / docs / redundant_closure_for_method_calls.txt
1 ### What it does
2 Checks for closures which only invoke a method on the closure
3 argument and can be replaced by referencing the method directly.
4
5 ### Why is this bad?
6 It's unnecessary to create the closure.
7
8 ### Example
9 ```
10 Some('a').map(|s| s.to_uppercase());
11 ```
12 may be rewritten as
13 ```
14 Some('a').map(char::to_uppercase);
15 ```