mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 15:51:12 +00:00
Avoid a clone
This commit is contained in:
parent
8d0c1ddc68
commit
497a5af72d
1 changed files with 5 additions and 1 deletions
|
@ -171,12 +171,16 @@ impl<'a> Procs<'a> {
|
||||||
.from_var(env.arena, annotation, env.subs)
|
.from_var(env.arena, annotation, env.subs)
|
||||||
.unwrap_or_else(|err| panic!("TODO turn fn_var into a RuntimeError {:?}", err));
|
.unwrap_or_else(|err| panic!("TODO turn fn_var into a RuntimeError {:?}", err));
|
||||||
|
|
||||||
|
let tuple = (symbol, layout);
|
||||||
|
let already_specialized = self.specialized.contains_key(&tuple);
|
||||||
|
let (symbol, layout) = tuple;
|
||||||
|
|
||||||
// if we've already specialized this one, no further work is needed.
|
// if we've already specialized this one, no further work is needed.
|
||||||
//
|
//
|
||||||
// NOTE: this #[allow(clippy::map_entry)] here is for correctness!
|
// NOTE: this #[allow(clippy::map_entry)] here is for correctness!
|
||||||
// Changing it to use .entry() would necessarily make it incorrect.
|
// Changing it to use .entry() would necessarily make it incorrect.
|
||||||
#[allow(clippy::map_entry)]
|
#[allow(clippy::map_entry)]
|
||||||
if !self.specialized.contains_key(&(symbol, layout.clone())) {
|
if !already_specialized {
|
||||||
let pending = PendingSpecialization {
|
let pending = PendingSpecialization {
|
||||||
ret_var,
|
ret_var,
|
||||||
fn_var: annotation,
|
fn_var: annotation,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue