rust/src/test/ui/suggestions/suggest-box.fixed
Esteban Küber fb2511c3c5 Suggest Box::new when appropriate
When encountering a boxed value as expected and a stack allocated value
that could be boxed to fulfill the expectation, like in the following
snippet, suggest `Box::new` wrapping.
2019-08-12 20:24:30 -07:00

9 lines
158 B
Rust

// run-rustfix
fn main() {
let _x: Box<dyn Fn() -> Result<(), ()>> = Box::new(|| { //~ ERROR mismatched types
Err(())?;
Ok(())
});
}