Revert boxing for large enum variant

This commit is contained in:
Igor Aleksanov 2020-08-10 15:50:27 +03:00
parent 6344a7f362
commit d180b8bbe8

View file

@ -106,9 +106,10 @@ struct FlycheckActor {
cargo_handle: Option<CargoHandle>,
}
#[allow(clippy::large_enum_variant)]
enum Event {
Restart(Restart),
CheckEvent(Option<Box<cargo_metadata::Message>>),
CheckEvent(Option<cargo_metadata::Message>),
}
impl FlycheckActor {
@ -123,7 +124,7 @@ impl FlycheckActor {
let check_chan = self.cargo_handle.as_ref().map(|cargo| &cargo.receiver);
select! {
recv(inbox) -> msg => msg.ok().map(Event::Restart),
recv(check_chan.unwrap_or(&never())) -> msg => Some(Event::CheckEvent(msg.ok().map(Box::new))),
recv(check_chan.unwrap_or(&never())) -> msg => Some(Event::CheckEvent(msg.ok())),
}
}
fn run(mut self, inbox: Receiver<Restart>) {
@ -149,7 +150,7 @@ impl FlycheckActor {
let res = cargo_handle.join();
self.send(Message::Progress(Progress::DidFinish(res)));
}
Event::CheckEvent(Some(message)) => match *message {
Event::CheckEvent(Some(message)) => match message {
cargo_metadata::Message::CompilerArtifact(msg) => {
self.send(Message::Progress(Progress::DidCheckCrate(msg.target.name)));
}