Could somebody help? How to fix this build error?
use std::fs::File;
fn main() {
let tmp = "tmp.zip";
let save_to_tmp_file = || {
let mut tmp_zip = File::create(tmp)?;
Ok(())
};
save_to_tmp_file();
}
The build error:
|
6 | let save_to_tmp_file = || {
| ---------------- consider giving `save_to_tmp_file` a type
7 | let mut tmp_zip = File::create(tmp)?;
| ^^^^^^^^^^^^^^^^^^ cannot infer type for `_`
The Rust Playground code is here.