Skip to content

Commit adaf5ac

Browse files
committed
controllers::team: Use json! macro to simplify JSON serialization code
1 parent 4261b5e commit adaf5ac

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/controllers/team.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,5 @@ pub fn show_team(req: &mut dyn RequestExt) -> EndpointResult {
1212
let conn = req.db_read_only()?;
1313
let team: Team = teams.filter(login.eq(name)).first(&*conn)?;
1414

15-
#[derive(Serialize)]
16-
struct R {
17-
team: EncodableTeam,
18-
}
19-
Ok(req.json(&R { team: team.into() }))
15+
Ok(req.json(&json!({ team: EncodableTeam::from(team) })))
2016
}

0 commit comments

Comments
 (0)