File tree Expand file tree Collapse file tree 2 files changed +5
-25
lines changed Expand file tree Collapse file tree 2 files changed +5
-25
lines changed Original file line number Diff line number Diff line change @@ -173,11 +173,7 @@ pub fn update_user(req: &mut dyn Request) -> AppResult<Response> {
173
173
Ok ( ( ) )
174
174
} ) ?;
175
175
176
- #[ derive( Serialize ) ]
177
- struct R {
178
- ok : bool ,
179
- }
180
- Ok ( req. json ( & R { ok : true } ) )
176
+ ok_true ( )
181
177
}
182
178
183
179
/// Handles the `PUT /confirm/:email_token` route
@@ -195,11 +191,7 @@ pub fn confirm_user_email(req: &mut dyn Request) -> AppResult<Response> {
195
191
return Err ( bad_request ( "Email belonging to token not found." ) ) ;
196
192
}
197
193
198
- #[ derive( Serialize ) ]
199
- struct R {
200
- ok : bool ,
201
- }
202
- Ok ( req. json ( & R { ok : true } ) )
194
+ ok_true ( )
203
195
}
204
196
205
197
/// Handles `PUT /user/:user_id/resend` route
@@ -226,11 +218,7 @@ pub fn regenerate_token_and_send(req: &mut dyn Request) -> AppResult<Response> {
226
218
. map_err ( |_| bad_request ( "Error in sending email" ) )
227
219
} ) ?;
228
220
229
- #[ derive( Serialize ) ]
230
- struct R {
231
- ok : bool ,
232
- }
233
- Ok ( req. json ( & R { ok : true } ) )
221
+ ok_true ( )
234
222
}
235
223
236
224
/// Handles `PUT /me/email_notifications` route
@@ -283,9 +271,5 @@ pub fn update_email_notifications(req: &mut dyn Request) -> AppResult<Response>
283
271
. set ( email_notifications. eq ( excluded ( email_notifications) ) )
284
272
. execute ( & * conn) ?;
285
273
286
- #[ derive( Serialize ) ]
287
- struct R {
288
- ok : bool ,
289
- }
290
- Ok ( req. json ( & R { ok : true } ) )
274
+ ok_true ( )
291
275
}
Original file line number Diff line number Diff line change @@ -40,9 +40,5 @@ fn modify_yank(req: &mut dyn Request, yanked: bool) -> AppResult<Response> {
40
40
. enqueue ( & conn)
41
41
. map_err ( |e| AppError :: from_std_error ( e) ) ?;
42
42
43
- #[ derive( Serialize ) ]
44
- struct R {
45
- ok : bool ,
46
- }
47
- Ok ( req. json ( & R { ok : true } ) )
43
+ ok_true ( )
48
44
}
You can’t perform that action at this time.
0 commit comments