diff --git a/viz-core/src/response.rs b/viz-core/src/response.rs index e761cc26..780f7319 100644 --- a/viz-core/src/response.rs +++ b/viz-core/src/response.rs @@ -1,6 +1,6 @@ use http_body_util::Full; -use crate::{header, Body, BoxError, Bytes, Error, Future, Response, Result, StatusCode}; +use crate::{header, Body, BoxError, Bytes, Response, Result, StatusCode}; /// The [`Response`] Extension. pub trait ResponseExt: private::Sealed + Sized { @@ -94,7 +94,10 @@ pub trait ResponseExt: private::Sealed + Sized { /// Downloads transfers the file from path as an attachment. #[cfg(feature = "fs")] - fn download(path: T, name: Option<&str>) -> impl Future> + Send + fn download( + path: T, + name: Option<&str>, + ) -> impl std::future::Future> + Send where T: AsRef + Send; @@ -231,7 +234,9 @@ impl ResponseExt for Response { let mut resp = Self::attachment(&format!("attachment; filename=\"{value}\"")); *resp.body_mut() = Body::from_stream(tokio_util::io::ReaderStream::new( - tokio::fs::File::open(path).await.map_err(Error::from)?, + tokio::fs::File::open(path) + .await + .map_err(crate::Error::from)?, )); Ok(resp) } diff --git a/viz-smol/src/server.rs b/viz-smol/src/server.rs index d35c698a..5b0aaa33 100644 --- a/viz-smol/src/server.rs +++ b/viz-smol/src/server.rs @@ -19,6 +19,7 @@ mod unix; pub mod tls; /// Serve a future using [`smol`]'s TCP listener. +#[allow(clippy::missing_errors_doc)] pub async fn serve<'ex, E, L>(executor: E, listener: L, router: Router) -> io::Result<()> where E: Borrow> + Clone + Send + 'ex, diff --git a/viz-test/Cargo.toml b/viz-test/Cargo.toml index 99f1f31a..94887deb 100644 --- a/viz-test/Cargo.toml +++ b/viz-test/Cargo.toml @@ -14,7 +14,7 @@ keywords = ["async", "framework", "http", "service", "web"] categories = ["asynchronous", "network-programming", "web-programming"] [dependencies] -viz.workspace = true +viz = { workspace = true, features = ["fs"] } bytes.workspace = true futures-util.workspace = true