mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 07:41:12 +00:00
copy instead of clone Content
This commit is contained in:
parent
1ff8261a66
commit
a9c8e2dc3e
4 changed files with 19 additions and 19 deletions
|
@ -331,7 +331,7 @@ fn unify_alias(
|
|||
}
|
||||
|
||||
if problems.is_empty() {
|
||||
problems.extend(merge(subs, ctx, other_content.clone()));
|
||||
problems.extend(merge(subs, ctx, *other_content));
|
||||
}
|
||||
|
||||
// if problems.is_empty() { problems.extend(unify_pool(subs, pool, real_var, *other_real_var)); }
|
||||
|
@ -374,7 +374,7 @@ fn unify_structure(
|
|||
match other {
|
||||
FlexVar(_) => {
|
||||
// If the other is flex, Structure wins!
|
||||
let outcome = merge(subs, ctx, Structure(flat_type.clone()));
|
||||
let outcome = merge(subs, ctx, Structure(*flat_type));
|
||||
|
||||
// And if we see a flex variable on the right hand side of a presence
|
||||
// constraint, we know we need to open up the structure we're trying to unify with.
|
||||
|
@ -1158,7 +1158,7 @@ fn unify_flat_type(
|
|||
use roc_types::subs::FlatType::*;
|
||||
|
||||
match (left, right) {
|
||||
(EmptyRecord, EmptyRecord) => merge(subs, ctx, Structure(left.clone())),
|
||||
(EmptyRecord, EmptyRecord) => merge(subs, ctx, Structure(*left)),
|
||||
|
||||
(Record(fields, ext), EmptyRecord) if fields.has_only_optional_fields(subs) => {
|
||||
unify_pool(subs, pool, *ext, ctx.second, ctx.mode)
|
||||
|
@ -1172,7 +1172,7 @@ fn unify_flat_type(
|
|||
unify_record(subs, pool, ctx, *fields1, *ext1, *fields2, *ext2)
|
||||
}
|
||||
|
||||
(EmptyTagUnion, EmptyTagUnion) => merge(subs, ctx, Structure(left.clone())),
|
||||
(EmptyTagUnion, EmptyTagUnion) => merge(subs, ctx, Structure(*left)),
|
||||
|
||||
(TagUnion(tags, ext), EmptyTagUnion) if tags.is_empty() => {
|
||||
unify_pool(subs, pool, *ext, ctx.second, ctx.mode)
|
||||
|
@ -1277,7 +1277,7 @@ fn unify_flat_type(
|
|||
if tag_name_1_ref == tag_name_2_ref {
|
||||
let problems = unify_pool(subs, pool, *ext1, *ext2, ctx.mode);
|
||||
if problems.is_empty() {
|
||||
let content = subs.get_content_without_compacting(ctx.second).clone();
|
||||
let content = *subs.get_content_without_compacting(ctx.second);
|
||||
merge(subs, ctx, content)
|
||||
} else {
|
||||
problems
|
||||
|
@ -1369,7 +1369,7 @@ fn unify_rigid(
|
|||
mismatch!("Rigid {:?} with {:?}", ctx.first, &other)
|
||||
} else {
|
||||
// We are treating rigid vars as flex vars; admit this
|
||||
merge(subs, ctx, other.clone())
|
||||
merge(subs, ctx, *other)
|
||||
}
|
||||
}
|
||||
Error => {
|
||||
|
@ -1401,7 +1401,7 @@ fn unify_flex(
|
|||
// TODO special-case boolean here
|
||||
// In all other cases, if left is flex, defer to right.
|
||||
// (This includes using right's name if both are flex and named.)
|
||||
merge(subs, ctx, other.clone())
|
||||
merge(subs, ctx, *other)
|
||||
}
|
||||
|
||||
Error => merge(subs, ctx, Error),
|
||||
|
@ -1424,7 +1424,7 @@ fn unify_recursion(
|
|||
} => {
|
||||
// NOTE: structure and other_structure may not be unified yet, but will be
|
||||
// we should not do that here, it would create an infinite loop!
|
||||
let name = opt_name.clone().or_else(|| other_opt_name.clone());
|
||||
let name = (*opt_name).or_else(|| *other_opt_name);
|
||||
merge(
|
||||
subs,
|
||||
ctx,
|
||||
|
@ -1446,7 +1446,7 @@ fn unify_recursion(
|
|||
ctx,
|
||||
RecursionVar {
|
||||
structure,
|
||||
opt_name: opt_name.clone(),
|
||||
opt_name: *opt_name,
|
||||
},
|
||||
),
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue