2018-07-28 15:34:52 +00:00
|
|
|
#![warn(clippy::redundant_closure_call)]
|
2016-03-03 19:14:49 +00:00
|
|
|
|
|
|
|
fn main() {
|
2018-12-09 22:26:16 +00:00
|
|
|
let a = (|| 42)();
|
2017-02-08 13:58:07 +00:00
|
|
|
|
2018-12-09 22:26:16 +00:00
|
|
|
let mut i = 1;
|
|
|
|
let mut k = (|m| m + 1)(i);
|
2016-03-03 19:14:49 +00:00
|
|
|
|
2018-12-09 22:26:16 +00:00
|
|
|
k = (|a, b| a * b)(1, 5);
|
2016-03-03 19:14:49 +00:00
|
|
|
|
2018-12-09 22:26:16 +00:00
|
|
|
let closure = || 32;
|
|
|
|
i = closure();
|
2016-03-03 19:14:49 +00:00
|
|
|
|
2018-12-09 22:26:16 +00:00
|
|
|
let closure = |i| i + 1;
|
|
|
|
i = closure(3);
|
2016-03-03 19:14:49 +00:00
|
|
|
|
2018-12-09 22:26:16 +00:00
|
|
|
i = closure(4);
|
2018-11-14 06:01:39 +00:00
|
|
|
|
|
|
|
#[allow(clippy::needless_return)]
|
|
|
|
(|| return 2)();
|
|
|
|
(|| -> Option<i32> { None? })();
|
|
|
|
(|| -> Result<i32, i32> { r#try!(Err(2)) })();
|
2016-03-03 19:14:49 +00:00
|
|
|
}
|