File tree Expand file tree Collapse file tree 1 file changed +3
-13
lines changed Expand file tree Collapse file tree 1 file changed +3
-13
lines changed Original file line number Diff line number Diff line change @@ -99,11 +99,7 @@ pub fn download(req: &mut dyn RequestExt) -> EndpointResult {
99
99
}
100
100
101
101
if req. wants_json ( ) {
102
- #[ derive( Serialize ) ]
103
- struct R {
104
- url : String ,
105
- }
106
- Ok ( req. json ( & R { url : redirect_url } ) )
102
+ Ok ( req. json ( & json ! ( { "url" : redirect_url } ) ) )
107
103
} else {
108
104
Ok ( req. redirect ( redirect_url) )
109
105
}
@@ -129,13 +125,7 @@ pub fn downloads(req: &mut dyn RequestExt) -> EndpointResult {
129
125
. load ( & * conn) ?
130
126
. into_iter ( )
131
127
. map ( VersionDownload :: into)
132
- . collect ( ) ;
128
+ . collect :: < Vec < EncodableVersionDownload > > ( ) ;
133
129
134
- #[ derive( Serialize ) ]
135
- struct R {
136
- version_downloads : Vec < EncodableVersionDownload > ,
137
- }
138
- Ok ( req. json ( & R {
139
- version_downloads : downloads,
140
- } ) )
130
+ Ok ( req. json ( & json ! ( { "version_downloads" : downloads } ) ) )
141
131
}
You can’t perform that action at this time.
0 commit comments