diff --git a/holo-northbound/src/configuration.rs b/holo-northbound/src/configuration.rs index 2624140c..9fe556a3 100644 --- a/holo-northbound/src/configuration.rs +++ b/holo-northbound/src/configuration.rs @@ -663,7 +663,7 @@ where // Move to a separate vector the changes that need to be relayed. let callbacks = P::callbacks().unwrap(); let relayed_changes = changes - .drain_filter(|(cb_key, _)| callbacks.0.get(cb_key).is_none()) + .extract_if(|(cb_key, _)| callbacks.0.get(cb_key).is_none()) .collect(); // Process local changes. diff --git a/holo-northbound/src/lib.rs b/holo-northbound/src/lib.rs index ba2efe8d..6b5463f2 100644 --- a/holo-northbound/src/lib.rs +++ b/holo-northbound/src/lib.rs @@ -4,7 +4,7 @@ // See LICENSE for license details. // -#![feature(drain_filter)] +#![feature(extract_if)] #![warn(rust_2018_idioms)] #![allow(type_alias_bounds)] #![allow(clippy::too_many_arguments)] diff --git a/holo-ospf/src/events.rs b/holo-ospf/src/events.rs index 61c6c973..58bf03a1 100644 --- a/holo-ospf/src/events.rs +++ b/holo-ospf/src/events.rs @@ -1266,7 +1266,7 @@ where // retransmission lists. for lse_idx in lsdb .maxage_lsas - .drain_filter(|lse_idx| { + .extract_if(|lse_idx| { let lse = &arenas.lsa_entries[*lse_idx]; !arenas.neighbors.iter().any(|(_, nbr)| { nbr.lists diff --git a/holo-ospf/src/lib.rs b/holo-ospf/src/lib.rs index 078db94e..a8b2fc4d 100644 --- a/holo-ospf/src/lib.rs +++ b/holo-ospf/src/lib.rs @@ -11,7 +11,7 @@ )] #![allow(clippy::single_match, clippy::too_many_arguments)] #![allow(type_alias_bounds)] -#![feature(btree_drain_filter, hash_drain_filter, ip, let_chains, lazy_cell)] +#![feature(btree_extract_if, hash_extract_if, ip, let_chains, lazy_cell)] pub mod area; pub mod collections; diff --git a/holo-ospf/src/route.rs b/holo-ospf/src/route.rs index 1b1ef3f0..000e8f96 100644 --- a/holo-ospf/src/route.rs +++ b/holo-ospf/src/route.rs @@ -209,7 +209,7 @@ pub(crate) fn update_rib_partial( // Check for intra-area changes. if !partial.intra.is_empty() { // Remove affected intra-area routes from the RIB. - old_rib.extend(rib.drain_filter(|prefix, route| { + old_rib.extend(rib.extract_if(|prefix, route| { partial.intra.contains(prefix) && route.path_type == PathType::IntraArea })); @@ -235,7 +235,7 @@ pub(crate) fn update_rib_partial( // Check for inter-area changes. if !partial.inter_network.is_empty() { // Remove affected inter-area routes from the RIB. - old_rib.extend(rib.drain_filter(|prefix, route| { + old_rib.extend(rib.extract_if(|prefix, route| { partial.inter_network.contains(prefix) && route.path_type == PathType::InterArea })); @@ -273,7 +273,7 @@ pub(crate) fn update_rib_partial( } // Remove affected inter-area routes from the routers RIB. - area.state.routers.drain_filter(|router_id, route| { + let _ = area.state.routers.extract_if(|router_id, route| { partial.inter_router.contains(router_id) && route.path_type == PathType::InterArea }); @@ -294,7 +294,7 @@ pub(crate) fn update_rib_partial( let reevaluate_all = !partial.inter_router.is_empty(); // Remove affected external routes from the RIB. - old_rib.extend(rib.drain_filter(|prefix, route| { + old_rib.extend(rib.extract_if(|prefix, route| { (reevaluate_all || partial.external.contains(prefix)) && matches!( route.path_type,