FnOnce already replaces FnBox, so why implement it yourself?
- 删除以下代码:
trait FnBox {
fn call_box(self: Box<Self>);
}
impl<F: FnOnce()> FnBox for F {
fn call_box(self: Box<F>) {
(*self)()
}
}
- 修改代码
type Thunk<'a> = Box<FnBox + Send + 'a>;
改成
type Thunk<'a> = Box<dyn FnOnce() -> () + Send + 'a>;
改成
FnOnce already replaces FnBox, so why implement it yourself?
改成
改成