diff --git a/cot/src/middleware/live_reload.rs b/cot/src/middleware/live_reload.rs index 9ea31521..ad7f22ad 100644 --- a/cot/src/middleware/live_reload.rs +++ b/cot/src/middleware/live_reload.rs @@ -169,7 +169,6 @@ mod tests { test_live_reload_from_context(false).await; } - #[expect(clippy::future_not_send, reason = "test function using Bootstrapper")] async fn test_live_reload_from_context(enabled: bool) { struct TestProject; impl Project for TestProject {} diff --git a/cot/src/project.rs b/cot/src/project.rs index 786c7eaf..8c66bbb9 100644 --- a/cot/src/project.rs +++ b/cot/src/project.rs @@ -849,7 +849,7 @@ async fn default_error_handler(error: RequestOuterError) -> crate::Result { #[debug("..")] - project: Box, + project: Box, context: ProjectContext, handler: S::RequestHandler, error_handler: S::ErrorHandler, @@ -874,7 +874,7 @@ impl Bootstrapper { /// # } /// ``` #[must_use] - pub fn new(project: P) -> Self { + pub fn new(project: P) -> Self { Self { project: Box::new(project), context: ProjectContext::new(), @@ -1085,8 +1085,6 @@ impl Bootstrapper { /// # Ok(()) /// # } /// ``` - // Send not needed; Bootstrapper is run async in a single thread - #[expect(clippy::future_not_send)] pub async fn boot(self) -> cot::Result> { self.with_apps().boot().await } @@ -1171,8 +1169,6 @@ impl Bootstrapper { /// # Ok(()) /// # } /// ``` - // Send not needed; Bootstrapper is run async in a single thread - #[expect(clippy::future_not_send)] pub async fn boot(self) -> cot::Result> { self.with_database().await?.boot().await } @@ -1209,8 +1205,6 @@ impl Bootstrapper { /// # Ok(()) /// # } /// ``` - // Send not needed; Bootstrapper is run async in a single thread - #[expect(clippy::future_not_send)] pub async fn with_database(self) -> cot::Result> { #[cfg(feature = "db")] let database = Self::init_database(&self.context.config.database).await?; @@ -1275,8 +1269,6 @@ impl Bootstrapper { /// # } /// ``` // Function marked `async` to be consistent with the other `boot` methods - // Send not needed; Bootstrapper is run async in a single thread - #[expect(clippy::future_not_send)] pub async fn boot(self) -> cot::Result> { self.with_cache().await?.boot().await } @@ -1314,7 +1306,6 @@ impl Bootstrapper { /// # Ok(()) /// # } /// ``` - #[expect(clippy::future_not_send)] #[allow( clippy::unused_async, clippy::allow_attributes, @@ -1379,7 +1370,10 @@ impl Bootstrapper { /// # Ok(()) /// # } /// ``` - #[expect(clippy::unused_async, clippy::future_not_send)] + #[expect( + clippy::unused_async, + reason = "for consistency with other Bootstrapper::boot methods" + )] pub async fn boot(self) -> cot::Result> { let router_service = RouterService::new(Arc::clone(&self.context.router)); let handler_builder = RootHandlerBuilder { @@ -2057,10 +2051,6 @@ impl>> ProjectContext { /// # Errors /// /// This function returns an error if the server fails to start. -#[expect( - clippy::future_not_send, - reason = "Send not needed; Bootstrapper/CLI is run async in a single thread" -)] pub async fn run(bootstrapper: Bootstrapper, address_str: &str) -> cot::Result<()> { let listener = tokio::net::TcpListener::bind(address_str) .await @@ -2082,10 +2072,6 @@ pub async fn run(bootstrapper: Bootstrapper, address_str: &str) -> /// # Errors /// /// This function returns an error if the server fails to start. -#[expect( - clippy::future_not_send, - reason = "Send not needed; Bootstrapper/CLI is run async in a single thread" -)] pub async fn run_at( bootstrapper: Bootstrapper, listener: tokio::net::TcpListener, @@ -2106,10 +2092,6 @@ pub async fn run_at( /// # Errors /// /// This function returns an error if the server fails to start. -#[expect( - clippy::future_not_send, - reason = "Send not needed; Bootstrapper/CLI is run async in a single thread" -)] pub async fn run_at_with_shutdown( bootstrapper: Bootstrapper, listener: tokio::net::TcpListener, @@ -2326,7 +2308,7 @@ pub(crate) fn prepare_request_for_error_handler(request_head: &mut RequestHead, /// # } /// ``` #[expect(clippy::future_not_send)] // Send not needed; CLI is run async in a single thread -pub async fn run_cli(project: impl Project + 'static) -> cot::Result<()> { +pub async fn run_cli(project: impl Project + Send + 'static) -> cot::Result<()> { Bootstrapper::new(project).run_cli().await } diff --git a/cot/src/test.rs b/cot/src/test.rs index e9448be3..2beee985 100644 --- a/cot/src/test.rs +++ b/cot/src/test.rs @@ -92,10 +92,9 @@ impl Client { /// } /// ``` #[must_use] - #[expect(clippy::future_not_send)] // used in the test code pub async fn new

(project: P) -> Self where - P: Project + 'static, + P: Project + Send + 'static, { let config = project.config("test").expect("Could not get test config"); let bootstrapper = Bootstrapper::new(project) @@ -1351,7 +1350,7 @@ pub struct TestServerBuilder { project: T, } -impl TestServerBuilder { +impl TestServerBuilder { /// Create a new test server. /// /// # Examples @@ -1444,7 +1443,7 @@ pub struct TestServer { project: PhantomData T>, } -impl TestServer { +impl TestServer { async fn start(project: T) -> Self { let tcp_listener = TcpListener::bind("0.0.0.0:0") .await