rust/tests/target/issue-4577.rs
Stéphane Campinas c536d80dc1 Fix rewrite of closures with a return type
If the closure's body fits in a line, the block is removed but it is
necessary if the closure has a return type.
2020-12-20 12:05:05 -06:00

16 lines
303 B
Rust

fn main() {
let s: String = "ABAABBAA"
.chars()
.filter(|c| if *c == 'A' { true } else { false })
.map(|c| -> char {
if c == 'A' {
'0'
} else {
'1'
}
})
.collect();
println!("{}", s);
}