Skip to content

Commit

Permalink
chore: reformat if-let chains
Browse files Browse the repository at this point in the history
Reformat the codebase now that rustfmt supports if-let chains (yay!).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
  • Loading branch information
rwestphal committed Oct 27, 2023
1 parent 65c3858 commit 4eb69dc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
5 changes: 2 additions & 3 deletions holo-bfd/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,8 @@ impl Session {
{
// (Re)start Tx interval.
let sockaddr = self.state.sockaddr.unwrap();
let task = tasks::udp_tx_interval(
self, interval, socket_tx, sockaddr
);
let task =
tasks::udp_tx_interval(self, interval, socket_tx, sockaddr);
self.state.tx_interval = Some(task);
} else {
// Stop Tx interval.
Expand Down
10 changes: 6 additions & 4 deletions holo-ospf/src/ospfv3/packet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,8 @@ impl PacketVersion<Self> for Ospfv3 {
// structures, which would require the introduction of locking
// primitives.
if let Some(options) = options
&& auth.is_some() != options.contains(Options::AT) {
&& auth.is_some() != options.contains(Options::AT)
{
return Err(DecodeError::AuthTypeMismatch);
}
if auth.is_none() {
Expand All @@ -810,14 +811,15 @@ impl PacketVersion<Self> for Ospfv3 {

// Ignore optional LLS block (only present in Hello and Database
// Description packets).
if let Some(options) = &options && options.contains(Options::L) {
if let Some(options) = &options
&& options.contains(Options::L)
{
if buf.remaining() < LLS_HDR_SIZE as usize {
return Err(DecodeError::InvalidLength(buf.len() as u16));
}
let _lls_cksum = buf.get_u16();
let lls_block_len = buf.get_u16();
if buf.remaining() < (lls_block_len * 4 - LLS_HDR_SIZE) as usize
{
if buf.remaining() < (lls_block_len * 4 - LLS_HDR_SIZE) as usize {
return Err(DecodeError::InvalidLength(buf.len() as u16));
}
buf.advance(lls_block_len as usize);
Expand Down

0 comments on commit 4eb69dc

Please sign in to comment.