Skip to content

Commit e636437

Browse files
authored
controllers/site_metadata: Avoid unnecessary allocation (#11221)
1 parent c044370 commit e636437

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/controllers/site_metadata.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ pub struct MetadataResponse<'a> {
2929
pub async fn get_site_metadata(state: AppState) -> impl IntoResponse {
3030
let read_only = state.config.db.are_all_read_only();
3131

32-
let deployed_sha =
33-
dotenvy::var("HEROKU_SLUG_COMMIT").unwrap_or_else(|_| String::from("unknown"));
32+
let deployed_sha = dotenvy::var("HEROKU_SLUG_COMMIT");
33+
let deployed_sha = deployed_sha.as_deref().unwrap_or("unknown");
3434

3535
Json(MetadataResponse {
36-
deployed_sha: &deployed_sha,
37-
commit: &deployed_sha,
36+
deployed_sha,
37+
commit: deployed_sha,
3838
read_only,
3939
})
4040
.into_response()

0 commit comments

Comments
 (0)