mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 06:10:44 +08:00
http: Apply warnings from clippy
This commit is contained in:
@@ -45,7 +45,7 @@ pub fn reactions(
|
||||
/// Returns JSON for an `Edit`.
|
||||
pub fn embeds(embeds: &[cob::Embed<cob::Uri>]) -> Vec<Value> {
|
||||
embeds
|
||||
.into_iter()
|
||||
.iter()
|
||||
.map(|e| {
|
||||
json!({
|
||||
"name": e.name,
|
||||
@@ -73,7 +73,7 @@ impl<'a> Author<'a> {
|
||||
}
|
||||
|
||||
pub fn as_json(&self, aliases: &impl AliasStore) -> Value {
|
||||
aliases.alias(&self.0).map_or(
|
||||
aliases.alias(self.0).map_or(
|
||||
json!({ "id": self.0 }),
|
||||
|alias| json!({ "id": self.0, "alias": alias, }),
|
||||
)
|
||||
|
||||
@@ -22,14 +22,14 @@ impl<'a> Issue<'a> {
|
||||
pub fn as_json(&self, id: issue::IssueId, aliases: &impl AliasStore) -> Value {
|
||||
json!({
|
||||
"id": id.to_string(),
|
||||
"author": Author::new(&self.0.author().id()).as_json(aliases),
|
||||
"author": Author::new(self.0.author().id()).as_json(aliases),
|
||||
"title": self.0.title(),
|
||||
"state": self.0.state(),
|
||||
"assignees": self.0.assignees().map(|assignee|
|
||||
Author::new(assignee).as_json(aliases)
|
||||
).collect::<Vec<_>>(),
|
||||
"discussion": self.0.comments().map(|(id, c)|
|
||||
thread::Comment::Issue(&c).as_json(id, aliases)
|
||||
thread::Comment::Issue(c).as_json(id, aliases)
|
||||
).collect::<Vec<_>>(),
|
||||
"labels": self.0.labels().collect::<Vec<_>>(),
|
||||
})
|
||||
@@ -66,7 +66,7 @@ impl<'a> Patch<'a> {
|
||||
Author::new(&assignee).as_json(aliases)
|
||||
).collect::<Vec<_>>(),
|
||||
"revisions": self.0.revisions().map(|(id, rev)|
|
||||
Revision::new(&rev).as_json(id, repo, aliases)
|
||||
Revision::new(rev).as_json(id, repo, aliases)
|
||||
).collect::<Vec<_>>(),
|
||||
})
|
||||
}
|
||||
@@ -115,11 +115,11 @@ impl<'a> Revision<'a> {
|
||||
"oid": self.0.head(),
|
||||
"refs": refs,
|
||||
"discussions": self.0.discussion().comments().map(|(id, c)|
|
||||
thread::Comment::Patch(&c).as_json(id, aliases)
|
||||
thread::Comment::Patch(c).as_json(id, aliases)
|
||||
).collect::<Vec<_>>(),
|
||||
"timestamp": self.0.timestamp().as_secs(),
|
||||
"reviews": self.0.reviews().into_iter().map(|(_, r)|
|
||||
Review::new(&r).as_json(aliases)
|
||||
"reviews": self.0.reviews().map(|(_, r)|
|
||||
Review::new(r).as_json(aliases)
|
||||
).collect::<Vec<_>>(),
|
||||
})
|
||||
}
|
||||
@@ -139,7 +139,7 @@ impl<'a> Review<'a> {
|
||||
"verdict": self.0.verdict(),
|
||||
"summary": self.0.summary(),
|
||||
"comments": self.0.comments().map(|(id, c)|
|
||||
thread::Comment::Patch(&c).as_json(id, aliases)
|
||||
thread::Comment::Patch(c).as_json(id, aliases)
|
||||
).collect::<Vec<_>>(),
|
||||
"timestamp": self.0.timestamp().as_secs(),
|
||||
})
|
||||
|
||||
@@ -13,7 +13,7 @@ impl<'a> Diff<'a> {
|
||||
pub fn as_json(&self) -> Value {
|
||||
let s = self.0.stats();
|
||||
json!({
|
||||
"files": self.0.files().into_iter().map(|f| {
|
||||
"files": self.0.files().map(|f| {
|
||||
match f {
|
||||
surf::diff::FileDiff::Added(added) => json!({
|
||||
"status": "added",
|
||||
@@ -142,7 +142,7 @@ impl<'a> DiffContent<'a> {
|
||||
surf::diff::DiffContent::Plain { hunks, stats, eof } => {
|
||||
let hunks = hunks
|
||||
.iter()
|
||||
.map(|h| Hunk::new(&h).as_json())
|
||||
.map(|h| Hunk::new(h).as_json())
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
json!({
|
||||
@@ -233,7 +233,7 @@ impl<'a> Hunk<'a> {
|
||||
.0
|
||||
.lines
|
||||
.iter()
|
||||
.map(|line| Modification::new(&line).as_json())
|
||||
.map(|line| Modification::new(line).as_json())
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
json!({
|
||||
|
||||
@@ -35,7 +35,7 @@ impl<'a> Comment<'a> {
|
||||
"reactions": reactions(c.reactions(), None, aliases),
|
||||
"timestamp": c.timestamp().as_secs(),
|
||||
"replyTo": c.reply_to(),
|
||||
"location": c.location().map(|l| diff::CodeLocation::new(&l).as_json()),
|
||||
"location": c.location().map(|l| diff::CodeLocation::new(l).as_json()),
|
||||
"resolved": c.is_resolved(),
|
||||
}),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user