Skip to content

Commit

Permalink
Use Into::into instead of a closure in radicle-types
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastinez committed Nov 22, 2024
1 parent c176fb9 commit 4670370
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion crates/radicle-types/src/cobs/patch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ impl Revision {
.map(|(emoji, authors)| {
cobs::thread::Reaction::new(
*emoji,
authors.into_iter().map(|a| a.into()).collect::<Vec<_>>(),
authors.into_iter().map(Into::into).collect::<Vec<_>>(),
location
.as_ref()
.map(|l| cobs::thread::CodeLocation::new(l.clone())),
Expand Down
4 changes: 2 additions & 2 deletions crates/radicle-types/src/cobs/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl Comment<CodeLocation> {
.map(|(reaction, authors)| {
cobs::thread::Reaction::new(
*reaction,
authors.into_iter().map(|s| s.into()).collect(),
authors.into_iter().map(Into::into).collect(),
None,
aliases,
)
Expand Down Expand Up @@ -108,7 +108,7 @@ impl Comment<cobs::Never> {
.map(|(reaction, authors)| {
cobs::thread::Reaction::new(
*reaction,
authors.into_iter().map(|m| m.into()).collect::<Vec<_>>(),
authors.into_iter().map(Into::into).collect::<Vec<_>>(),
None,
aliases,
)
Expand Down
6 changes: 3 additions & 3 deletions crates/radicle-types/src/traits/issue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ pub trait IssuesMut: Profile {
new.description,
&new.labels,
&new.assignees,
new.embeds.into_iter().map(|e| e.into()).collect::<Vec<_>>(),
new.embeds.into_iter().map(Into::into).collect::<Vec<_>>(),
&signer,
)?;

Expand Down Expand Up @@ -164,15 +164,15 @@ pub trait IssuesMut: Profile {
issue.comment(
body,
reply_to.unwrap_or(cob_id),
embeds.into_iter().map(|e| e.into()).collect::<Vec<_>>(),
embeds.into_iter().map(Into::into).collect::<Vec<_>>(),
&signer,
)?;
}
cobs::issue::Action::CommentEdit { id, body, embeds } => {
issue.edit_comment(
id,
body,
embeds.into_iter().map(|e| e.into()).collect::<Vec<_>>(),
embeds.into_iter().map(Into::into).collect::<Vec<_>>(),
&signer,
)?;
}
Expand Down
12 changes: 6 additions & 6 deletions crates/radicle-types/src/traits/patch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ pub trait PatchesMut: Profile {
patch.edit_revision(
revision,
description,
embeds.into_iter().map(|e| e.into()).collect::<Vec<_>>(),
embeds.into_iter().map(Into::into).collect::<Vec<_>>(),
&signer,
)?;
}
Expand Down Expand Up @@ -187,7 +187,7 @@ pub trait PatchesMut: Profile {
body,
location.map(|l| l.into()),
reply_to,
embeds.into_iter().map(|e| e.into()).collect::<Vec<_>>(),
embeds.into_iter().map(Into::into).collect::<Vec<_>>(),
&signer,
)?;
}
Expand All @@ -201,7 +201,7 @@ pub trait PatchesMut: Profile {
review,
comment,
body,
embeds.into_iter().map(|e| e.into()).collect::<Vec<_>>(),
embeds.into_iter().map(Into::into).collect::<Vec<_>>(),
&signer,
)?;
}
Expand Down Expand Up @@ -240,7 +240,7 @@ pub trait PatchesMut: Profile {
body,
reply_to,
location.map(|l| l.into()),
embeds.into_iter().map(|e| e.into()).collect::<Vec<_>>(),
embeds.into_iter().map(Into::into).collect::<Vec<_>>(),
&signer,
)?;
}
Expand All @@ -254,7 +254,7 @@ pub trait PatchesMut: Profile {
revision,
comment,
body,
embeds.into_iter().map(|e| e.into()).collect::<Vec<_>>(),
embeds.into_iter().map(Into::into).collect::<Vec<_>>(),
&signer,
)?;
}
Expand Down Expand Up @@ -409,7 +409,7 @@ pub trait PatchesMut: Profile {
new.body,
new.location.map(|l| l.into()),
new.reply_to,
new.embeds.into_iter().map(|e| e.into()).collect::<Vec<_>>(),
new.embeds.into_iter().map(Into::into).collect::<Vec<_>>(),
)?;

Ok(())
Expand Down
8 changes: 4 additions & 4 deletions crates/radicle-types/src/traits/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub trait Thread: Profile {
let oid = issue.comment(
n.body,
id,
n.embeds.into_iter().map(|e| e.into()).collect::<Vec<_>>(),
n.embeds.into_iter().map(Into::into).collect::<Vec<_>>(),
&signer,
)?;

Expand All @@ -72,7 +72,7 @@ pub trait Thread: Profile {
new.body,
id.into(),
None,
new.embeds.into_iter().map(|e| e.into()).collect::<Vec<_>>(),
new.embeds.into_iter().map(Into::into).collect::<Vec<_>>(),
LocalTime::now().into(),
),
aliases,
Expand All @@ -98,7 +98,7 @@ pub trait Thread: Profile {
n.body,
n.reply_to,
n.location.map(|l| l.into()),
n.embeds.into_iter().map(|e| e.into()).collect::<Vec<_>>(),
n.embeds.into_iter().map(Into::into).collect::<Vec<_>>(),
&signer,
)?;

Expand All @@ -113,7 +113,7 @@ pub trait Thread: Profile {
new.body,
new.reply_to,
new.location.map(|l| l.into()),
new.embeds.into_iter().map(|e| e.into()).collect::<Vec<_>>(),
new.embeds.into_iter().map(Into::into).collect::<Vec<_>>(),
LocalTime::now().into(),
),
aliases,
Expand Down

0 comments on commit 4670370

Please sign in to comment.