Simplify get_secret using Option chain
https://claude.ai/code/session_01MtUMXi7Z3GCDWQFY8puWpu
diff --git a/quire-server/src/quire/web/api.rs b/quire-server/src/quire/web/api.rs
index ce24d4b..533d9b0 100644
--- a/quire-server/src/quire/web/api.rs
+++ b/quire-server/src/quire/web/api.rs
@@ -217,10 +217,12 @@ async fn get_secret(
) -> Result<axum::Json<serde_json::Value>, ApiError> {
let value = tokio::task::spawn_blocking(move || -> std::result::Result<String, ApiError> {
let config = quire.global_config()?;
- if let Some(s) = config.secrets.get(&name) {
- return Ok(s.reveal()?.to_string());
- }
- Err(ApiError::NotFound)
+ Ok(config
+ .secrets
+ .get(&name)
+ .ok_or(ApiError::NotFound)?
+ .reveal()?
+ .to_string())
})
.await
.expect("blocking task panicked")?;