Commit cd639160 authored by Jeff Smits's avatar Jeff Smits

cargo fmt && cargo clippy

parent 09fe570d
......@@ -186,12 +186,12 @@ impl<'s> ATermWrite for ImportModName<'s> {
write!(writer, "Import(")?;
name.to_ascii(writer)?;
write!(writer, ")")
},
}
ImportModName::ImportWildcard(name) => {
write!(writer, "ImportWildcard(")?;
name.to_ascii(writer)?;
write!(writer, ")")
},
}
}
}
}
......@@ -325,7 +325,7 @@ impl<'s> ATermWrite for Sort<'s> {
write!(writer, "SortVar(")?;
id.to_ascii(writer)?;
write!(writer, ")")
},
}
Sort::SortNoArgs(id) => {
write!(writer, "SortNoArgs(")?;
id.to_ascii(writer)?;
......
......@@ -420,9 +420,9 @@ fn eval_match<'d, 'f: 'd>(
let result = build_term::build(term, context)?;
*cache.borrow_mut() = Some(result.clone());
if result == *current {
return Ok(());
Ok(())
} else {
return Err(Error::StrategyFailed);
Err(Error::StrategyFailed)
}
}
}
......
......@@ -407,7 +407,7 @@ impl<'a> ATermWrite for Strategy<'a> {
strat.to_ascii(writer)?;
}
}
write!(writer, "{}", str::repeat(")", strategies.len()-1))
write!(writer, "{}", str::repeat(")", strategies.len() - 1))
}
Strategy::GuardedLChoice(ref pairs, ref final_else) => {
for &(ref cond, ref then) in pairs.iter() {
......@@ -453,11 +453,11 @@ impl<'a> ATermWrite for Strategy<'a> {
sarg.to_ascii(writer)?;
write!(writer, ")")
}
Strategy::ImportTerm(ref name) => {
Strategy::ImportTerm(name) => {
write!(writer, "ImportTerm(")?;
name.to_ascii(writer)?;
write!(writer, ")")
},
}
}
}
}
......@@ -595,7 +595,10 @@ impl<'a> TryFrom<ctree::PreTerm<'a>> for (BuildTerm<'a>, SizeEstimate) {
impl<'a> ATermWrite for BuildTerm<'a> {
fn to_ascii<W: fmt::Write>(&self, writer: &mut W) -> fmt::Result {
fn not_anno_wrapped<'a, W: fmt::Write>(term: &BuildTerm<'a>, writer: &mut W) -> fmt::Result {
fn not_anno_wrapped<'a, W: fmt::Write>(
term: &BuildTerm<'a>,
writer: &mut W,
) -> fmt::Result {
match *term {
BuildTerm::Var(name) => {
write!(writer, "Var(")?;
......@@ -647,7 +650,9 @@ impl<'a> ATermWrite for BuildTerm<'a> {
write!(writer, ")")
}
BuildTerm::Int(i) => write!(writer, "Anno(Int({:?}),Op(\"Nil\",[]))", i.to_string()),
BuildTerm::Real(BrokenF32(f)) => write!(writer, "Anno(Real({:?}),Op(\"Nil\",[]))", f.to_string()),
BuildTerm::Real(BrokenF32(f)) => {
write!(writer, "Anno(Real({:?}),Op(\"Nil\",[]))", f.to_string())
}
BuildTerm::Str(string) => {
write!(writer, "Anno(Str(")?;
string.to_ascii(writer)?;
......@@ -778,7 +783,10 @@ fn mptf(value: ctree::PreTerm) -> Result<(MatchTerm, SizeEstimate)> {
impl<'a> ATermWrite for MatchTerm<'a> {
fn to_ascii<W: fmt::Write>(&self, writer: &mut W) -> fmt::Result {
fn not_anno_wrapped<'a, W: fmt::Write>(term: &MatchTerm<'a>, writer: &mut W) -> fmt::Result {
fn not_anno_wrapped<'a, W: fmt::Write>(
term: &MatchTerm<'a>,
writer: &mut W,
) -> fmt::Result {
match *term {
MatchTerm::Var(name) => {
write!(writer, "Var(")?;
......@@ -844,7 +852,7 @@ impl<'a> ATermWrite for MatchTerm<'a> {
write!(writer, "Anno(Str(")?;
string.to_ascii(writer)?;
write!(writer, "),Wld)")
},
}
MatchTerm::Op(cons, ref children) => {
write!(writer, "Anno(Op(")?;
cons.to_ascii(writer)?;
......@@ -903,16 +911,18 @@ pub mod full_ctree {
fn try_from(value: ctree::Module<'a>) -> result::Result<Self, Self::Err> {
match value {
ctree::Module::Module(name, decls) => {
decls.into_iter()
decls
.into_iter()
.map(TryInto::try_into)
.collect::<Result<_>>()
.map(|decls| Module::Module(name, decls))
}
ctree::Module::Specification(decls) => {
decls.into_iter()
decls
.into_iter()
.map(TryInto::try_into)
.collect::<Result<_>>()
.map(|defs| Module::Specification(defs))
.map(Module::Specification)
}
}
}
......@@ -954,7 +964,7 @@ pub mod full_ctree {
defs.into_iter()
.map(TryInto::try_into)
.collect::<Result<_>>()
.map(|defs| Decl::Strategies(defs))
.map(Decl::Strategies)
}
ctree::Decl::Signature(sdecls) => Ok(Decl::Signature(sdecls)),
}
......@@ -997,14 +1007,20 @@ pub mod full_ctree {
fn try_from(value: ctree::Def<'a>) -> result::Result<Self, Self::Err> {
match value {
ctree::Def::SDefT(name, sargs, targs, body) => {
body.try_into().map(|body| Def::SDefT(name, sargs, targs, body))
body.try_into().map(
|body| Def::SDefT(name, sargs, targs, body),
)
}
ctree::Def::ExtSDef(name, sargs, targs) => Ok(Def::ExtSDef(name, sargs, targs)),
ctree::Def::ExtSDefInl(name, sargs, targs, body) => {
body.try_into().map(|body| Def::ExtSDefInl(name, sargs, targs, body))
body.try_into().map(|body| {
Def::ExtSDefInl(name, sargs, targs, body)
})
}
ctree::Def::AnnoDef(annos, sdeft) => {
sdeft.try_into().map(|def| Def::AnnoDef(annos, Box::new(def)))
sdeft.try_into().map(
|def| Def::AnnoDef(annos, Box::new(def)),
)
}
}
}
......@@ -1066,11 +1082,15 @@ pub mod full_ctree {
use ctree::StrategyDef;
match value {
StrategyDef::SDefT(name, sargs, targs, body) => {
body.try_into().map(|body| Def::SDefT(name, sargs, targs, body))
body.try_into().map(
|body| Def::SDefT(name, sargs, targs, body),
)
}
StrategyDef::ExtSDef(name, sargs, targs) => Ok(Def::ExtSDef(name, sargs, targs)),
StrategyDef::ExtSDefInl(name, sargs, targs, body) => {
body.try_into().map(|body| Def::ExtSDefInl(name, sargs, targs, body))
body.try_into().map(|body| {
Def::ExtSDefInl(name, sargs, targs, body)
})
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment