removed unstable lets

This commit is contained in:
elvis
2025-09-17 00:57:16 +02:00
parent 83923b80e5
commit 7f07eb66f7
3 changed files with 30 additions and 26 deletions

View File

@ -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)) /// Finds only the rules X = pre(Q, rec(X)), but not only x = pre(Q, rec(x))
/// to use in filter_map. /// to use in filter_map.
fn filter_delta<'a>(&'a self, id: &Self::Id) -> Option<&'a Self::Set> { fn filter_delta<'a>(&'a self, id: &Self::Id) -> Option<&'a Self::Set> {
#[allow(clippy::collapsible_if)]
if let Self::EntitySet { if let Self::EntitySet {
entities, entities,
next_process, next_process,
} = self } = 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 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)) /// Finds only the rules X = pre(Q, rec(X)), but not only x = pre(Q, rec(x))
/// to use in filter_map. /// to use in filter_map.
fn filter_delta(&self, id: &Self::Id) -> Option<&Self::Set> { fn filter_delta(&self, id: &Self::Id) -> Option<&Self::Set> {
#[allow(clippy::collapsible_if)]
if let Self::EntitySet { if let Self::EntitySet {
entities, entities,
next_process, next_process,
} = self } = 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 None
} }
} }

View File

@ -464,12 +464,10 @@ impl BasicSet for PositiveSet {
.identifiers .identifiers
.iter() .iter()
.filter(|(id, s)| { .filter(|(id, s)| {
if let Some(s1) = other.identifiers.get(id) if let Some(s1) = other.identifiers.get(id) {
&& s1 == *s s1 == *s
{
false
} else { } else {
true false
} }
}) })
.map(|(id, s)| (*id, *s)) .map(|(id, s)| (*id, *s))
@ -486,10 +484,8 @@ impl BasicSet for PositiveSet {
} }
fn contains(&self, el: &Self::Element) -> bool { fn contains(&self, el: &Self::Element) -> bool {
if let Some(e) = self.identifiers.get(&el.id) if let Some(e) = self.identifiers.get(&el.id) {
&& *e == el.state *e == el.state
{
true
} else { } else {
false false
} }
@ -632,10 +628,11 @@ impl PositiveSet {
pub fn opposite_intersection(&self, other: &Self) -> Vec<IdType> { pub fn opposite_intersection(&self, other: &Self) -> Vec<IdType> {
let mut ret = vec![]; let mut ret = vec![];
for (el, state) in self { for (el, state) in self {
if let Some(state2) = other.identifiers.get(el) #[allow(clippy::collapsible_if)]
&& *state == !*state2 if let Some(state2) = other.identifiers.get(el) {
{ if *state == !*state2 {
ret.push(*el); ret.push(*el);
}
} }
} }
ret ret

View File

@ -177,9 +177,10 @@ impl<T: BasicSystem> ExtensionsSystem for T {
} }
let mut n = 1; let mut n = 1;
let mut current = current.unwrap().1; let mut current = current.unwrap().1;
while let Some((_, next)) = current.one_transition()? while let Some((_, next)) = current.one_transition()? {
&& n < limit if n >= limit {
{ break;
}
current = next; current = next;
n += 1; n += 1;
} }
@ -222,9 +223,10 @@ impl<T: BasicSystem> ExtensionsSystem for T {
let (available_entities, context, t) = current.0.get_context(); let (available_entities, context, t) = current.0.get_context();
res.push((available_entities.clone(), context.clone(), t.clone())); res.push((available_entities.clone(), context.clone(), t.clone()));
let mut current = current.1; let mut current = current.1;
while let Some((label, next)) = current.one_transition()? while let Some((label, next)) = current.one_transition()? {
&& limit > 1 if limit <= 1 {
{ break;
}
limit -= 1; limit -= 1;
current = next; current = next;
let (available_entities, context, t) = label.get_context(); let (available_entities, context, t) = label.get_context();