From 82cd53de366f8080d12f26d9a1fc67cc24c612ef Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Tue, 19 Apr 2022 13:03:58 -0700 Subject: [PATCH] Add 'must_use' to 'Rocket'. Closes #2146. --- core/lib/src/rocket.rs | 1 + core/lib/tests/mount_point.rs | 4 ++-- core/lib/tests/timer-on-attach.rs | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/lib/src/rocket.rs b/core/lib/src/rocket.rs index cc45f64e..f0acef05 100644 --- a/core/lib/src/rocket.rs +++ b/core/lib/src/rocket.rs @@ -107,6 +107,7 @@ use crate::log::PaintExt; /// rocket::build() /// } /// ``` +#[must_use] pub struct Rocket(pub(crate) P::State); impl Rocket { diff --git a/core/lib/tests/mount_point.rs b/core/lib/tests/mount_point.rs index fc3e89a3..2221c882 100644 --- a/core/lib/tests/mount_point.rs +++ b/core/lib/tests/mount_point.rs @@ -1,10 +1,10 @@ #[test] #[should_panic] fn bad_dynamic_mount() { - rocket::build().mount("", vec![]); + let _ = rocket::build().mount("", vec![]); } #[test] fn good_static_mount() { - rocket::build().mount("/abcdefghijkl_mno", vec![]); + let _ = rocket::build().mount("/abcdefghijkl_mno", vec![]); } diff --git a/core/lib/tests/timer-on-attach.rs b/core/lib/tests/timer-on-attach.rs index 46533eab..9a98aac1 100644 --- a/core/lib/tests/timer-on-attach.rs +++ b/core/lib/tests/timer-on-attach.rs @@ -7,7 +7,7 @@ async fn test_await_timer_inside_attach() { rocket::tokio::time::sleep(std::time::Duration::from_millis(100)).await; } - rocket::build() + let _ = rocket::build() .attach(rocket::fairing::AdHoc::on_ignite("1", |rocket| async { do_async_setup().await; rocket