Skip to content

Commit

Permalink
fix: fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
vinisilvag committed Jan 18, 2024
1 parent bf53297 commit 7398610
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions carcara/src/checker/rules/strings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,25 @@ fn flatten(term: Rc<Term>, pool: &mut dyn TermPool) -> Vec<Rc<Term>> {
s.chars()
.map(|c| pool.add(Term::Const(Constant::String(c.to_string())))),
);
} else {
if let Some(args) = match_term!((strconcat ...) = term) {
for arg in args {
match arg.as_ref() {
Term::Const(Constant::String(s)) => {
flattened.extend(
s.chars()
.map(|c| pool.add(Term::Const(Constant::String(c.to_string())))),
);
}
Term::Op(Operator::StrConcat, _) => {
flattened.extend(flatten(arg.clone(), pool));
}
_ => {
flattened.push(arg.clone());
}
};
}
} else {
flattened.push(term.clone());
} else if let Some(args) = match_term!((strconcat ...) = term) {
for arg in args {
match arg.as_ref() {
Term::Const(Constant::String(s)) => {
flattened.extend(
s.chars()
.map(|c| pool.add(Term::Const(Constant::String(c.to_string())))),
);
}
Term::Op(Operator::StrConcat, _) => {
flattened.extend(flatten(arg.clone(), pool));
}
_ => {
flattened.push(arg.clone());
}
};
}
} else {
flattened.push(term.clone());
}
flattened
}
Expand Down

0 comments on commit 7398610

Please sign in to comment.