From 7f07eb66f70402ce8ea22f248a45f4388e194786 Mon Sep 17 00:00:00 2001 From: elvis Date: Wed, 17 Sep 2025 00:57:16 +0200 Subject: [PATCH] removed unstable lets --- rsprocess/src/process.rs | 19 ++++++++++++------- rsprocess/src/set.rs | 23 ++++++++++------------- rsprocess/src/system.rs | 14 ++++++++------ 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/rsprocess/src/process.rs b/rsprocess/src/process.rs index 13f0bdb..682388b 100644 --- a/rsprocess/src/process.rs +++ b/rsprocess/src/process.rs @@ -135,14 +135,17 @@ impl BasicProcess for Process { /// Finds only the rules X = pre(Q, rec(X)), but not only x = pre(Q, rec(x)) /// to use in filter_map. fn filter_delta<'a>(&'a self, id: &Self::Id) -> Option<&'a Self::Set> { + #[allow(clippy::collapsible_if)] if let Self::EntitySet { entities, next_process, } = self - && let Self::RecursiveIdentifier { identifier } = &**next_process - && identifier == id { - return Some(entities); + if let Self::RecursiveIdentifier { identifier } = &**next_process + && identifier == id + { + return Some(entities); + } } None @@ -346,16 +349,18 @@ impl BasicProcess for PositiveProcess { /// Finds only the rules X = pre(Q, rec(X)), but not only x = pre(Q, rec(x)) /// to use in filter_map. fn filter_delta(&self, id: &Self::Id) -> Option<&Self::Set> { + #[allow(clippy::collapsible_if)] if let Self::EntitySet { entities, next_process, } = self - && let Self::RecursiveIdentifier { identifier } = &**next_process - && identifier == id { - return Some(entities); + if let Self::RecursiveIdentifier { identifier } = &**next_process + && identifier == id + { + return Some(entities); + } } - None } } diff --git a/rsprocess/src/set.rs b/rsprocess/src/set.rs index 19d5d4e..63060a9 100644 --- a/rsprocess/src/set.rs +++ b/rsprocess/src/set.rs @@ -464,12 +464,10 @@ impl BasicSet for PositiveSet { .identifiers .iter() .filter(|(id, s)| { - if let Some(s1) = other.identifiers.get(id) - && s1 == *s - { - false + if let Some(s1) = other.identifiers.get(id) { + s1 == *s } else { - true + false } }) .map(|(id, s)| (*id, *s)) @@ -486,10 +484,8 @@ impl BasicSet for PositiveSet { } fn contains(&self, el: &Self::Element) -> bool { - if let Some(e) = self.identifiers.get(&el.id) - && *e == el.state - { - true + if let Some(e) = self.identifiers.get(&el.id) { + *e == el.state } else { false } @@ -632,10 +628,11 @@ impl PositiveSet { pub fn opposite_intersection(&self, other: &Self) -> Vec { let mut ret = vec![]; for (el, state) in self { - if let Some(state2) = other.identifiers.get(el) - && *state == !*state2 - { - ret.push(*el); + #[allow(clippy::collapsible_if)] + if let Some(state2) = other.identifiers.get(el) { + if *state == !*state2 { + ret.push(*el); + } } } ret diff --git a/rsprocess/src/system.rs b/rsprocess/src/system.rs index 6cc08ac..9c08129 100644 --- a/rsprocess/src/system.rs +++ b/rsprocess/src/system.rs @@ -177,9 +177,10 @@ impl ExtensionsSystem for T { } let mut n = 1; let mut current = current.unwrap().1; - while let Some((_, next)) = current.one_transition()? - && n < limit - { + while let Some((_, next)) = current.one_transition()? { + if n >= limit { + break; + } current = next; n += 1; } @@ -222,9 +223,10 @@ impl ExtensionsSystem for T { let (available_entities, context, t) = current.0.get_context(); res.push((available_entities.clone(), context.clone(), t.clone())); let mut current = current.1; - while let Some((label, next)) = current.one_transition()? - && limit > 1 - { + while let Some((label, next)) = current.one_transition()? { + if limit <= 1 { + break; + } limit -= 1; current = next; let (available_entities, context, t) = label.get_context();