Skip to content

Commit

Permalink
Remove useless clone by destructuring on fallback.
Browse files Browse the repository at this point in the history
This allows us to remove additional code.
  • Loading branch information
scrabsha committed Mar 2, 2021
1 parent bc29ae9 commit c77d831
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/bastion/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,6 @@ impl AnswerSender {
.send(SignedMessage::new(msg, sign))
.map_err(|smsg| smsg.msg.try_unwrap().unwrap())
}

/// Returns the sender signature.
pub fn signature(&self) -> &RefAddr {
&self.1
}
}

impl Msg {
Expand Down Expand Up @@ -1049,7 +1044,7 @@ impl<O> MessageHandler<O> {
F: FnOnce(&dyn Any, RefAddr) -> O,
{
self.state
.output_or_else(|msg| f(msg.msg.as_ref(), msg.signature().clone()))
.output_or_else(|SignedMessage { msg, sign }| f(msg.as_ref(), sign))
}

/// Calls a function if the incoming message is a broadcast and has a
Expand Down

0 comments on commit c77d831

Please sign in to comment.