Skip to content

Commit

Permalink
dont clone when splitting
Browse files Browse the repository at this point in the history
  • Loading branch information
joe-prosser committed Jul 25, 2024
1 parent 5b9eb2b commit d25c17f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ pub use crate::{
pub struct Token(pub String);

pub trait SplittableRequest {
fn split(&self) -> Vec<Self>
fn split(self) -> Vec<Self>
where
Self: Sized;

Expand Down
10 changes: 4 additions & 6 deletions api/src/resources/comment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,11 @@ pub(crate) struct PutCommentsRequest {
}

impl SplittableRequest for PutCommentsRequest {
fn split(&self) -> Vec<Self> {
fn split(self) -> Vec<Self> {
self.comments
.clone()
.into_iter()
.map(|comment| Self {
comments: [comment].to_vec(),
comments: vec![comment],
})
.collect()
}
Expand Down Expand Up @@ -208,15 +207,14 @@ pub(crate) struct SyncCommentsRequest {
}

impl SplittableRequest for SyncCommentsRequest {
fn split(&self) -> Vec<Self>
fn split(self) -> Vec<Self>
where
Self: Sized,
{
self.comments
.clone()
.into_iter()
.map(|comment| Self {
comments: [comment].to_vec(),
comments: vec![comment],
})
.collect()
}
Expand Down
5 changes: 2 additions & 3 deletions api/src/resources/email.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,14 @@ pub(crate) struct PutEmailsRequest {
}

impl SplittableRequest for PutEmailsRequest {
fn split(&self) -> Vec<Self>
fn split(self) -> Vec<Self>
where
Self: Sized,
{
self.emails
.clone()
.into_iter()
.map(|email| Self {
emails: [email].to_vec(),
emails: vec![email],
})
.collect()
}
Expand Down

0 comments on commit d25c17f

Please sign in to comment.