Skip to content

Commit 904ea10

Browse files
ndmitchellfacebook-github-bot
authored andcommitted
Avoid more box
Reviewed By: yangdanny97 Differential Revision: D75456356 fbshipit-source-id: 8a6fa636841545874048f85bdb9bb954e1e5a348
1 parent 2363b48 commit 904ea10

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

pyrefly/lib/binding/bindings.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -900,8 +900,8 @@ impl<'a> BindingsBuilder<'a> {
900900
let mut constraints = None;
901901
let kind = match x {
902902
TypeParam::TypeVar(tv) => {
903-
if let Some(box bound_expr) = &mut tv.bound {
904-
if let Expr::Tuple(tuple) = bound_expr {
903+
if let Some(bound_expr) = &mut tv.bound {
904+
if let Expr::Tuple(tuple) = &mut **bound_expr {
905905
let mut constraint_exprs = Vec::new();
906906
for constraint in &mut tuple.elts {
907907
self.ensure_type(constraint, &mut None);
@@ -910,26 +910,26 @@ impl<'a> BindingsBuilder<'a> {
910910
constraints = Some((constraint_exprs, bound_expr.range()))
911911
} else {
912912
self.ensure_type(bound_expr, &mut None);
913-
bound = Some(bound_expr);
913+
bound = Some((**bound_expr).clone());
914914
}
915915
}
916-
if let Some(box default_expr) = &mut tv.default {
916+
if let Some(default_expr) = &mut tv.default {
917917
self.ensure_type(default_expr, &mut None);
918-
default = Some(default_expr);
918+
default = Some((**default_expr).clone());
919919
}
920920
QuantifiedKind::TypeVar
921921
}
922922
TypeParam::ParamSpec(x) => {
923-
if let Some(box default_expr) = &mut x.default {
923+
if let Some(default_expr) = &mut x.default {
924924
self.ensure_type(default_expr, &mut None);
925-
default = Some(default_expr);
925+
default = Some((**default_expr).clone());
926926
}
927927
QuantifiedKind::ParamSpec
928928
}
929929
TypeParam::TypeVarTuple(x) => {
930-
if let Some(box default_expr) = &mut x.default {
930+
if let Some(default_expr) = &mut x.default {
931931
self.ensure_type(default_expr, &mut None);
932-
default = Some(default_expr);
932+
default = Some((**default_expr).clone());
933933
}
934934
QuantifiedKind::TypeVarTuple
935935
}
@@ -942,8 +942,8 @@ impl<'a> BindingsBuilder<'a> {
942942
name: name.id.clone(),
943943
unique: self.uniques.fresh(),
944944
kind,
945-
default: default.cloned(),
946-
bound: bound.cloned(),
945+
default,
946+
bound,
947947
constraints,
948948
})),
949949
FlowStyle::None,

0 commit comments

Comments
 (0)