Skip to content

Commit

Permalink
Unnecessary clones of types
Browse files Browse the repository at this point in the history
Reviewed By: blackm00n

Differential Revision: D63439789

fbshipit-source-id: 6827d94d8e98ce9e8e709c3321a903be933cfb61
  • Loading branch information
stepancheg authored and facebook-github-bot committed Sep 26, 2024
1 parent 3000af2 commit 4c31833
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions starlark/src/typing/callable_param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ impl ParamSpec {
}

/// All parameters are required and positional only.
pub(crate) fn all_required_pos_only(&self) -> Option<Vec<Ty>> {
pub(crate) fn all_required_pos_only(&self) -> Option<Vec<&Ty>> {
match self.split() {
ParamSpecSplit {
pos_only,
Expand All @@ -344,7 +344,7 @@ impl ParamSpec {
} => pos_only
.iter()
.map(|p| match p.mode {
ParamMode::PosOnly(ParamIsRequired::Yes) => Some(p.ty.dupe()),
ParamMode::PosOnly(ParamIsRequired::Yes) => Some(&p.ty),
_ => None,
})
.collect(),
Expand Down
4 changes: 2 additions & 2 deletions starlark/src/typing/oracle/ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ impl<'a> TypingOracleCtx<'a> {

fn params_all_pos_only_intersect(
&self,
x: &[Ty],
x: &[&Ty],
y: &ParamSpec,
) -> Result<bool, InternalError> {
match self.validate_args(
Expand All @@ -864,7 +864,7 @@ impl<'a> TypingOracleCtx<'a> {
pos: x
.iter()
.map(|ty| Spanned {
node: ty.dupe(),
node: (*ty).dupe(),
// TODO(nga): proper span.
span: Span::default(),
})
Expand Down

0 comments on commit 4c31833

Please sign in to comment.