Merge pull request 'Convert Infaliable Result into Option and handle' (#90) from 89_fix-warning-with-handling-infaliable-result-in-fileserv-rs into main

Reviewed-on: LibreTunes/LibreTunes#90
This commit is contained in:
Ethan Girouard 2024-09-16 01:44:52 +00:00
commit 266bba05aa

View File

@ -29,11 +29,11 @@ cfg_if! { if #[cfg(feature = "ssr")] {
let req = Request::builder().uri(uri.clone()).body(Body::empty()).unwrap(); let req = Request::builder().uri(uri.clone()).body(Body::empty()).unwrap();
// `ServeDir` implements `tower::Service` so we can call it with `tower::ServiceExt::oneshot` // `ServeDir` implements `tower::Service` so we can call it with `tower::ServiceExt::oneshot`
// This path is relative to the cargo root // This path is relative to the cargo root
match ServeDir::new(root).oneshot(req).await { match ServeDir::new(root).oneshot(req).await.ok() {
Ok(res) => Ok(res.into_response()), Some(res) => Ok(res.into_response()),
Err(err) => Err(( None => Err((
StatusCode::INTERNAL_SERVER_ERROR, StatusCode::INTERNAL_SERVER_ERROR,
format!("Something went wrong: {err}"), format!("Something went wrong"),
)), )),
} }
} }