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,15 +135,18 @@ 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
{
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
{
if let Self::RecursiveIdentifier { identifier } = &**next_process
&& identifier == id
{
return Some(entities);
}
}
None
}
}

View File

@ -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,12 +628,13 @@ impl PositiveSet {
pub fn opposite_intersection(&self, other: &Self) -> Vec<IdType> {
let mut ret = vec![];
for (el, state) in self {
if let Some(state2) = other.identifiers.get(el)
&& *state == !*state2
{
#[allow(clippy::collapsible_if)]
if let Some(state2) = other.identifiers.get(el) {
if *state == !*state2 {
ret.push(*el);
}
}
}
ret
}

View File

@ -177,9 +177,10 @@ impl<T: BasicSystem> 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<T: BasicSystem> 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();