Skip to content

Commit

Permalink
chore: run cargo fmt to address formatting changes on nightly
Browse files Browse the repository at this point in the history
rustfmt on nightly seems to be going through some instability. This
commit reformats the code to align with the latest update, partially
reverting changes introduced in commit 4dd4a0b.

Signed-off-by: Renato Westphal <[email protected]>
  • Loading branch information
rwestphal committed Feb 2, 2025
1 parent eb0639a commit 2801876
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 39 deletions.
10 changes: 6 additions & 4 deletions holo-bgp/src/neighbor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -661,11 +661,13 @@ impl Neighbor {
// Sends a BGP OPEN message based on the local configuration.
fn open_send(&mut self, instance_cfg: &InstanceCfg, identifier: Ipv4Addr) {
// Base capabilities.
let mut capabilities: BTreeSet<_> =
[Capability::RouteRefresh, Capability::FourOctetAsNumber {
let mut capabilities: BTreeSet<_> = [
Capability::RouteRefresh,
Capability::FourOctetAsNumber {
asn: instance_cfg.asn,
}]
.into();
},
]
.into();

// Multiprotocol capabilities.
if let Some(afi_safi) = self.config.afi_safi.get(&AfiSafi::Ipv4Unicast)
Expand Down
46 changes: 28 additions & 18 deletions holo-isis/src/lsdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,22 +254,29 @@ fn lsp_build_tlvs(

let prefix = addr.apply_mask();
if metric_type.is_standard_enabled() {
ipv4_internal_reach.insert(prefix, Ipv4Reach {
ie_bit: false,
metric: std::cmp::min(metric, MAX_NARROW_METRIC) as u8,
metric_delay: None,
metric_expense: None,
metric_error: None,
ipv4_internal_reach.insert(
prefix,
});
Ipv4Reach {
ie_bit: false,
metric: std::cmp::min(metric, MAX_NARROW_METRIC)
as u8,
metric_delay: None,
metric_expense: None,
metric_error: None,
prefix,
},
);
}
if metric_type.is_wide_enabled() {
ext_ipv4_reach.insert(prefix, ExtIpv4Reach {
metric,
up_down: false,
ext_ipv4_reach.insert(
prefix,
sub_tlvs: Default::default(),
});
ExtIpv4Reach {
metric,
up_down: false,
prefix,
sub_tlvs: Default::default(),
},
);
}
}
}
Expand All @@ -285,13 +292,16 @@ fn lsp_build_tlvs(
ipv6_addrs.insert(addr.ip());

let prefix = addr.apply_mask();
ipv6_reach.insert(prefix, Ipv6Reach {
metric,
up_down: false,
external: false,
ipv6_reach.insert(
prefix,
sub_tlvs: Default::default(),
});
Ipv6Reach {
metric,
up_down: false,
external: false,
prefix,
sub_tlvs: Default::default(),
},
);
}
}
}
Expand Down
7 changes: 4 additions & 3 deletions holo-isis/tests/packet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,10 @@ static LAN_HELLO1: Lazy<(Vec<u8>, Option<&Key>, Pdu)> = Lazy::new(|| {
list: vec![AreaAddr::from([0x49, 0x00, 0x00].as_slice())],
}],
neighbors: vec![NeighborsTlv {
list: vec![[0x3e, 0x25, 0x6d, 0x6d, 0x1b, 0x25], [
0x3e, 0xe8, 0x34, 0x2b, 0x1f, 0x96,
]],
list: vec![
[0x3e, 0x25, 0x6d, 0x6d, 0x1b, 0x25],
[0x3e, 0xe8, 0x34, 0x2b, 0x1f, 0x96],
],
}],
ipv4_addrs: vec![Ipv4AddressesTlv {
list: vec![Ipv4Addr::from_str("10.0.1.1").unwrap()],
Expand Down
18 changes: 12 additions & 6 deletions holo-northbound/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,12 @@ where
// Keyed list.
Some(cb) => {
// Get YANG object from callback.
let obj = (*cb)(provider, GetObjectArgs {
list_entry: &list_entry,
});
let obj = (*cb)(
provider,
GetObjectArgs {
list_entry: &list_entry,
},
);

// Get list keys.
let keys = obj.list_keys();
Expand Down Expand Up @@ -460,9 +463,12 @@ where
});

// Find the list entry associated to the provided path.
if let Some(mut list_iter) = (*cb_iterate)(provider, GetIterateArgs {
parent_list_entry: &list_entry,
}) {
if let Some(mut list_iter) = (*cb_iterate)(
provider,
GetIterateArgs {
parent_list_entry: &list_entry,
},
) {
if let Some(entry) = list_iter.find(|entry| {
let obj =
(*cb_get)(provider, GetObjectArgs { list_entry: entry });
Expand Down
19 changes: 11 additions & 8 deletions holo-ospf/src/ospfv2/lsdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -670,14 +670,17 @@ fn lsa_orig_ext_prefix(
prefix_sids
.insert(*algo, PrefixSid::new(psid_flags, *algo, sid));

prefixes.insert(*prefix, ExtPrefixTlv {
route_type: ExtPrefixRouteType::IntraArea,
af: 0,
flags,
prefix: *prefix,
prefix_sids,
unknown_tlvs: vec![],
});
prefixes.insert(
*prefix,
ExtPrefixTlv {
route_type: ExtPrefixRouteType::IntraArea,
af: 0,
flags,
prefix: *prefix,
prefix_sids,
unknown_tlvs: vec![],
},
);
}
}
}
Expand Down

0 comments on commit 2801876

Please sign in to comment.