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 @@ -165,11 +165,7 @@ pub fn update_user(req: &mut dyn Request) -> AppResult<Response> {
165
165
Ok ( ( ) )
166
166
} ) ?;
167
167
168
- #[ derive( Serialize ) ]
169
- struct R {
170
- ok : bool ,
171
- }
172
- Ok ( req. json ( & R { ok : true } ) )
168
+ ok_true ( )
173
169
}
174
170
175
171
/// Handles the `PUT /confirm/:email_token` route
@@ -187,11 +183,7 @@ pub fn confirm_user_email(req: &mut dyn Request) -> AppResult<Response> {
187
183
return Err ( bad_request ( "Email belonging to token not found." ) ) ;
188
184
}
189
185
190
- #[ derive( Serialize ) ]
191
- struct R {
192
- ok : bool ,
193
- }
194
- Ok ( req. json ( & R { ok : true } ) )
186
+ ok_true ( )
195
187
}
196
188
197
189
/// Handles `PUT /user/:user_id/resend` route
@@ -218,11 +210,7 @@ pub fn regenerate_token_and_send(req: &mut dyn Request) -> AppResult<Response> {
218
210
. map_err ( |_| bad_request ( "Error in sending email" ) )
219
211
} ) ?;
220
212
221
- #[ derive( Serialize ) ]
222
- struct R {
223
- ok : bool ,
224
- }
225
- Ok ( req. json ( & R { ok : true } ) )
213
+ ok_true ( )
226
214
}
227
215
228
216
/// Handles `PUT /me/email_notifications` route
@@ -275,9 +263,5 @@ pub fn update_email_notifications(req: &mut dyn Request) -> AppResult<Response>
275
263
. set ( email_notifications. eq ( excluded ( email_notifications) ) )
276
264
. execute ( & * conn) ?;
277
265
278
- #[ derive( Serialize ) ]
279
- struct R {
280
- ok : bool ,
281
- }
282
- Ok ( req. json ( & R { ok : true } ) )
266
+ ok_true ( )
283
267
}
Original file line number Diff line number Diff line change @@ -48,9 +48,5 @@ fn modify_yank(req: &mut dyn Request, yanked: bool) -> AppResult<Response> {
48
48
. enqueue ( & conn)
49
49
. map_err ( |e| AppError :: from_std_error ( e) ) ?;
50
50
51
- #[ derive( Serialize ) ]
52
- struct R {
53
- ok : bool ,
54
- }
55
- Ok ( req. json ( & R { ok : true } ) )
51
+ ok_true ( )
56
52
}
You can’t perform that action at this time.
0 commit comments