]> git.lizzy.rs Git - rust.git/blobdiff - src/eta_reduction.rs
added wiki comments + wiki-generating python script
[rust.git] / src / eta_reduction.rs
index 4957c2e21bc6dfb66a63dd2ed288d4c8e6316de1..c25228793e69a9fff16d85c628e5cb78620ea80c 100644 (file)
@@ -9,6 +9,13 @@
 pub struct EtaPass;
 
 
+/// **What it does:** This lint checks for closures which just call another function where the function can be called directly. `unsafe` functions or calls where types get adjusted are ignored. It is `Warn` by default.
+///
+/// **Why is this bad?** Needlessly creating a closure just costs heap space and adds code for no benefit.
+///
+/// **Known problems:** None
+///
+/// **Example:** `xs.map(|x| foo(x))` where `foo(_)` is a plain function that takes the exact argument type of `x`.
 declare_lint!(pub REDUNDANT_CLOSURE, Warn,
               "using redundant closures, i.e. `|a| foo(a)` (which can be written as just `foo`)");