Fought against clippy and lost

This commit is contained in:
Ayaz Hafiz 2022-04-22 15:30:55 -04:00
parent 7d908dc99c
commit 17e7b10267
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
3 changed files with 14 additions and 9 deletions

View file

@ -722,7 +722,7 @@ pub fn constrain_expr(
pattern_cons.push(expr_con); pattern_cons.push(expr_con);
// Now check the condition against the type expected by the branches. // Now check the condition against the type expected by the branches.
let sketched_rows = sketch_rows(real_cond_var, branches_region, &branches); let sketched_rows = sketch_rows(real_cond_var, branches_region, branches);
let cond_matches_branches_constraint = constraints.exhaustive( let cond_matches_branches_constraint = constraints.exhaustive(
real_cond_var, real_cond_var,
loc_cond.region, loc_cond.region,

View file

@ -5847,7 +5847,7 @@ fn to_opt_branches<'a>(
Ok((mono_pattern, assignments)) => { Ok((mono_pattern, assignments)) => {
loc_branches.push(( loc_branches.push((
Loc::at(loc_pattern.region, mono_pattern.clone()), Loc::at(loc_pattern.region, mono_pattern.clone()),
exhaustive_guard.clone(), exhaustive_guard,
)); ));
let mut loc_expr = when_branch.value.clone(); let mut loc_expr = when_branch.value.clone();
@ -5877,7 +5877,7 @@ fn to_opt_branches<'a>(
Err(runtime_error) => { Err(runtime_error) => {
loc_branches.push(( loc_branches.push((
Loc::at(loc_pattern.region, Pattern::Underscore), Loc::at(loc_pattern.region, Pattern::Underscore),
exhaustive_guard.clone(), exhaustive_guard,
)); ));
// TODO remove clone? // TODO remove clone?

View file

@ -1222,11 +1222,16 @@ fn solve(
let real_content = subs.get_content_without_compacting(real_var); let real_content = subs.get_content_without_compacting(real_var);
let branches_content = subs.get_content_without_compacting(branches_var); let branches_content = subs.get_content_without_compacting(branches_var);
let already_have_error = match (real_content, branches_content) { let already_have_error = matches!(
(Content::Error | Content::Structure(FlatType::Erroneous(_)), _) => true, (real_content, branches_content),
(_, Content::Error | Content::Structure(FlatType::Erroneous(_))) => true, (
_ => false, Content::Error | Content::Structure(FlatType::Erroneous(_)),
}; _
) | (
_,
Content::Error | Content::Structure(FlatType::Erroneous(_))
)
);
let snapshot = subs.snapshot(); let snapshot = subs.snapshot();
let outcome = unify(subs, real_var, branches_var, Mode::EQ); let outcome = unify(subs, real_var, branches_var, Mode::EQ);
@ -1303,7 +1308,7 @@ fn solve(
let sketched_rows = constraints.sketched_rows[sketched_rows.index()].clone(); let sketched_rows = constraints.sketched_rows[sketched_rows.index()].clone();
if should_check_exhaustiveness { if should_check_exhaustiveness {
let checked = roc_can::exhaustive::check(&subs, sketched_rows, context); let checked = roc_can::exhaustive::check(subs, sketched_rows, context);
if let Err(errors) = checked { if let Err(errors) = checked {
problems.extend(errors.into_iter().map(TypeError::Exhaustive)); problems.extend(errors.into_iter().map(TypeError::Exhaustive));
} }