Skip to content

Commit

Permalink
Follow some clippy suggestions and other misc cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulstansifer committed Oct 5, 2019
1 parent b1c4d6e commit a6190a0
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 28 deletions.
9 changes: 3 additions & 6 deletions src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,10 @@ impl Ast {
expd_form: ::std::rc::Rc<::form::Form>,
) -> Option<::util::mbe::EnvMBE<Ast>>
{
match self {
Node(ref f, ref parts, _) => {
if f == &expd_form {
return Some(parts.clone());
}
if let Node(ref f, ref parts, _) = self {
if f == &expd_form {
return Some(parts.clone());
}
_ => {}
}
None
}
Expand Down
3 changes: 0 additions & 3 deletions src/ast_walk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ impl<Elt: WalkElt> Clo<Elt> {
let o_renaming =
o_different_env.keyed_map_borrow_f(&mut |name, _| VariableReference(name.freshen()));

// if !o_renaming.empty() { println!("MERGE: {}", o_renaming); }

let mut fresh_o_env = Assoc::new();
for (o_name, o_val) in o_different_env.iter_pairs() {
fresh_o_env = fresh_o_env.set(
Expand Down Expand Up @@ -235,7 +233,6 @@ pub fn walk<Mode: WalkMode>(
} else {
walk_ctxt.env.clone()
};
// print!("↓↓↓↓: {:#?}\n : {:#?}\n", beta, new_env.map(|_| "…"));

let new__walk_ctxt = walk_ctxt.with_environment(new_env);
let new__walk_ctxt = // If the RHS is also binding, assume it's the same
Expand Down
4 changes: 2 additions & 2 deletions src/beta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ pub fn bound_from_beta(b: &Beta, parts: &EnvMBE<::ast::Ast>, quote_depth: i16) -
}
ShadowAll(ref sub_beta, ref drivers) => {
let mut res = vec![];
for ref sub_parts in parts.march_all(drivers) {
for sub_parts in &parts.march_all(drivers) {
res.append(&mut bound_from_beta(&*sub_beta, sub_parts, quote_depth));
}
res
Expand Down Expand Up @@ -398,7 +398,7 @@ pub fn bound_from_export_beta(
}
ExportBeta::ShadowAll(ref sub_beta, ref drivers) => {
let mut res = vec![];
for ref sub_parts in parts.march_all(drivers) {
for sub_parts in &parts.march_all(drivers) {
res.append(&mut bound_from_export_beta(&*sub_beta, sub_parts, quote_depth));
}
res
Expand Down
1 change: 0 additions & 1 deletion src/core_qq_forms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ pub fn unquote_form(nt: Name, pos_quot: bool, depth: u8) -> Rc<Form> {
unimplemented!("We may need a stack of what NTs are quoted")
}
ctxt_elt = more_quoted_ty(&ctxt_elt, nt);
println!("expected: {} ctxt: {}", expected_type, ctxt_elt);

let negative_parts = unquote_parts.switch_mode::<::ty::UnpackTy>();
let _res = negative_parts.with_context(ctxt_elt).get_res(n("body"))?;
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/reify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ impl Reifiable for () {

fn reify(&self) -> Value { Value::Int(BigInt::from(0)) }

fn reflect(_: &Value) -> Self { () }
fn reflect(_: &Value) -> Self {}
}

impl<T0: Reifiable, T1: Reifiable> Reifiable for (T0, T1) {
Expand Down
16 changes: 6 additions & 10 deletions src/ty_compare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,6 @@ impl ::walk_mode::NegativeWalkMode for Subtype {
.destructure(u_f.clone(), &Trivial)
.map(|p| ast_to_name(p.get_leaf_or_panic(&n("id"))));

// print!("%%: {}\n%%: {}\n", lhs, rhs);
// print!("in: {:#?}\n", env.map(|_| "…"));

match (lhs_name, rhs_name) {
// They are the same underdetermined type; nothing to do:
(Ok(l), Ok(r)) if l == r => {
Expand All @@ -444,13 +441,12 @@ impl ::walk_mode::NegativeWalkMode for Subtype {
})?;

// Now, resolve `:::[]:::` subtyping
match (&res_lhs.it, &mut res_rhs.it) {
(&Ty(Node(_, ref lhs_body, _)), &mut Ty(Node(_, ref mut rhs_body, _))) => {
// the LHS should be the subtype (i.e. already specific),
// and the RHS should be made to match
let _ = rhs_body.heal_splices__with(lhs_body, &match_dotdotdot(env));
}
_ => {}
if let (&Ty(Node(_, ref lhs_body, _)), &mut Ty(Node(_, ref mut rhs_body, _))) =
(&res_lhs.it, &mut res_rhs.it)
{
// the LHS should be the subtype (i.e. already specific),
// and the RHS should be made to match
let _ = rhs_body.heal_splices__with(lhs_body, &match_dotdotdot(env));
}
Some((res_lhs, res_rhs))
}
Expand Down
7 changes: 2 additions & 5 deletions src/unparse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,8 @@ pub fn unparse_mbe(pat: &FormPat, actl: &Ast, context: &EnvMBE<Ast>, s: &SynEnv)
// HACK: certain forms don't live in the syntax environment,
// but "belong" under an `Alt`, so just assume forms know their grammar:
if any_scopes {
match actl {
&Node(ref form_actual, ref body, _) => {
return unparse_mbe(&*form_actual.grammar, actl, body, s);
}
_ => {}
if let &Node(ref form_actual, ref body, _) = actl {
return unparse_mbe(&*form_actual.grammar, actl, body, s);
}
}

Expand Down

0 comments on commit a6190a0

Please sign in to comment.