@@ -100,34 +100,8 @@ pub async fn handle_compare(
100
100
101
101
Ok ( api:: comparison:: Response {
102
102
prev,
103
- a : api:: comparison:: ArtifactData {
104
- commit : match comparison. a . artifact . clone ( ) {
105
- ArtifactId :: Commit ( c) => c. sha ,
106
- ArtifactId :: Artifact ( t) => t,
107
- } ,
108
- date : if let ArtifactId :: Commit ( c) = & comparison. a . artifact {
109
- Some ( c. date )
110
- } else {
111
- None
112
- } ,
113
- pr : comparison. a . pr ,
114
- data : comparison. a . data ,
115
- bootstrap : comparison. a . bootstrap ,
116
- } ,
117
- b : api:: comparison:: ArtifactData {
118
- commit : match comparison. b . artifact . clone ( ) {
119
- ArtifactId :: Commit ( c) => c. sha ,
120
- ArtifactId :: Artifact ( t) => t,
121
- } ,
122
- date : if let ArtifactId :: Commit ( c) = & comparison. b . artifact {
123
- Some ( c. date )
124
- } else {
125
- None
126
- } ,
127
- pr : comparison. b . pr ,
128
- data : comparison. b . data ,
129
- bootstrap : comparison. b . bootstrap ,
130
- } ,
103
+ a : comparison. a . into ( ) ,
104
+ b : comparison. b . into ( ) ,
131
105
next,
132
106
is_contiguous,
133
107
} )
@@ -374,6 +348,25 @@ impl ArtifactData {
374
348
}
375
349
}
376
350
351
+ impl From < ArtifactData > for api:: comparison:: ArtifactData {
352
+ fn from ( data : ArtifactData ) -> Self {
353
+ api:: comparison:: ArtifactData {
354
+ commit : match data. artifact . clone ( ) {
355
+ ArtifactId :: Commit ( c) => c. sha ,
356
+ ArtifactId :: Artifact ( t) => t,
357
+ } ,
358
+ date : if let ArtifactId :: Commit ( c) = & data. artifact {
359
+ Some ( c. date )
360
+ } else {
361
+ None
362
+ } ,
363
+ pr : data. pr ,
364
+ data : data. data ,
365
+ bootstrap : data. bootstrap ,
366
+ }
367
+ }
368
+ }
369
+
377
370
// A comparison of two artifacts
378
371
pub struct Comparison {
379
372
pub a : ArtifactData ,
0 commit comments