Box::new(T::default())
RS-P1008Box::new(T::default())
is overly verbose, involving two function calls instead of one.
It can be better written as Box::<T>::default()
.
fn foo() {
let x: Box<String> = Box::new(Default::default());
let y = Box::new(i32::default());
}
fn foo() {
let x: Box<String> = Box::default();
let y = Box::<i32>::default();
}