]> git.proxmox.com Git - rustc.git/blob - src/tools/clippy/tests/ui/redundant_closure_call_early.rs
New upstream version 1.58.1+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / redundant_closure_call_early.rs
1 // non rustfixable, see redundant_closure_call_fixable.rs
2
3 #![warn(clippy::redundant_closure_call)]
4
5 fn main() {
6 let mut i = 1;
7
8 // lint here
9 let mut k = (|m| m + 1)(i);
10
11 // lint here
12 k = (|a, b| a * b)(1, 5);
13
14 // don't lint these
15 #[allow(clippy::needless_return)]
16 (|| return 2)();
17 (|| -> Option<i32> { None? })();
18 #[allow(clippy::try_err)]
19 (|| -> Result<i32, i32> { Err(2)? })();
20 }