Skip to content

Commit 88f509b

Browse files
committed
clippy / rustfmt
1 parent 3c94c78 commit 88f509b

2 files changed

Lines changed: 36 additions & 42 deletions

File tree

src/annot.rs

Lines changed: 30 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -235,25 +235,21 @@ where
235235
let (term, sort) = self.parse_atom_term()?;
236236

237237
let mut fields = Vec::new();
238-
loop {
239-
if let Some(Token {
240-
kind: TokenKind::Dot,
241-
..
242-
}) = self.look_ahead_token(0)
243-
{
244-
self.consume();
245-
match self.next_token("field")? {
246-
Token {
247-
kind: TokenKind::Literal(lit),
248-
..
249-
} if matches!(lit.kind, LitKind::Integer) => {
250-
let idx = lit.symbol.as_str().parse().unwrap();
251-
fields.push(idx);
252-
}
253-
t => return Err(ParseAttrError::unexpected_token("field", t.clone())),
238+
while let Some(Token {
239+
kind: TokenKind::Dot,
240+
..
241+
}) = self.look_ahead_token(0)
242+
{
243+
self.consume();
244+
match self.next_token("field")? {
245+
Token {
246+
kind: TokenKind::Literal(lit),
247+
..
248+
} if matches!(lit.kind, LitKind::Integer) => {
249+
let idx = lit.symbol.as_str().parse().unwrap();
250+
fields.push(idx);
254251
}
255-
} else {
256-
break;
252+
t => return Err(ParseAttrError::unexpected_token("field", t.clone())),
257253
}
258254
}
259255

@@ -428,36 +424,28 @@ where
428424

429425
fn parse_formula_and(&mut self) -> Result<chc::Formula<T::Output>> {
430426
let mut formula = self.parse_formula_atom()?;
431-
loop {
432-
match self.look_ahead_token(0) {
433-
Some(Token {
434-
kind: TokenKind::AndAnd,
435-
..
436-
}) => {
437-
self.consume();
438-
let next_formula = self.parse_formula_atom()?;
439-
formula = formula.and(next_formula);
440-
}
441-
_ => break,
442-
}
427+
while let Some(Token {
428+
kind: TokenKind::AndAnd,
429+
..
430+
}) = self.look_ahead_token(0)
431+
{
432+
self.consume();
433+
let next_formula = self.parse_formula_atom()?;
434+
formula = formula.and(next_formula);
443435
}
444436
Ok(formula)
445437
}
446438

447439
fn parse_formula(&mut self) -> Result<chc::Formula<T::Output>> {
448440
let mut formula = self.parse_formula_and()?;
449-
loop {
450-
match self.look_ahead_token(0) {
451-
Some(Token {
452-
kind: TokenKind::OrOr,
453-
..
454-
}) => {
455-
self.consume();
456-
let next_formula = self.parse_formula_and()?;
457-
formula = formula.or(next_formula);
458-
}
459-
_ => break,
460-
}
441+
while let Some(Token {
442+
kind: TokenKind::OrOr,
443+
..
444+
}) = self.look_ahead_token(0)
445+
{
446+
self.consume();
447+
let next_formula = self.parse_formula_and()?;
448+
formula = formula.or(next_formula);
461449
}
462450
Ok(formula)
463451
}

src/chc/clause_builder.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,24 +99,28 @@ impl ClauseBuilder {
9999
self
100100
}
101101

102+
/*
102103
pub fn add_body_mapped<T>(&mut self, atom: Atom<T>) -> &mut Self
103104
where
104105
T: Var + Debug,
105106
{
106107
self.add_body(atom.map_var(|v| self.mapped_var(v)))
107108
}
109+
*/
108110

109111
pub fn add_body_formula(&mut self, formula: Formula<TermVarIdx>) -> &mut Self {
110112
self.body_formula.push_conj(formula);
111113
self
112114
}
113115

116+
/*
114117
pub fn add_body_formula_mapped<T>(&mut self, formula: Formula<T>) -> &mut Self
115118
where
116119
T: Var + Debug,
117120
{
118121
self.add_body_formula(formula.map_var(|v| self.mapped_var(v)))
119122
}
123+
*/
120124

121125
pub fn head(&self, head: Atom<TermVarIdx>) -> Clause {
122126
let vars = self.vars.clone();
@@ -142,10 +146,12 @@ impl ClauseBuilder {
142146
}
143147
}
144148

149+
/*
145150
pub fn head_mapped<T>(&self, head: Atom<T>) -> Clause
146151
where
147152
T: Var + Debug,
148153
{
149154
self.head(head.map_var(|v| self.mapped_var(v)))
150155
}
156+
*/
151157
}

0 commit comments

Comments
 (0)