aboutsummaryrefslogtreecommitdiff
path: root/crates/whirl_api/src/lib.rs
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-05-28 00:06:40 -0700
committerFuwn <[email protected]>2021-05-28 00:06:40 -0700
commit179ce3277ece536cae41b834469f4065e3600d82 (patch)
treea96d55a34531c9761f6309c35f8d9cfab9879db6 /crates/whirl_api/src/lib.rs
parentMerge branch 'develop' of https://github.com/Whirlsplash/whirl into develop (diff)
downloadwhirl-179ce3277ece536cae41b834469f4065e3600d82.tar.xz
whirl-179ce3277ece536cae41b834469f4065e3600d82.zip
fix(global): a lot of clippy warnings
This change makes clippy **a lot** more strict.
Diffstat (limited to 'crates/whirl_api/src/lib.rs')
-rw-r--r--crates/whirl_api/src/lib.rs29
1 files changed, 25 insertions, 4 deletions
diff --git a/crates/whirl_api/src/lib.rs b/crates/whirl_api/src/lib.rs
index d2f7811..e6660a7 100644
--- a/crates/whirl_api/src/lib.rs
+++ b/crates/whirl_api/src/lib.rs
@@ -10,7 +10,15 @@
decl_macro,
proc_macro_hygiene
)]
-#![warn(rust_2018_idioms)]
+#![deny(
+ warnings,
+ nonstandard_style,
+ unused,
+ future_incompatible,
+ rust_2018_idioms,
+ unsafe_code
+)]
+#![deny(clippy::all, clippy::nursery, clippy::pedantic)]
#![recursion_limit = "128"]
#[macro_use]
@@ -25,6 +33,14 @@ mod routes;
pub struct Api;
impl Api {
/// Begin handling connections on the web-server.
+ ///
+ /// # Errors
+ /// - An error may arise if the web-server is unable to bind the specified
+ /// port.
+ ///
+ /// # Panics
+ /// - A panic may occur if the mpsc sender is unable to send a clone of the
+ /// server.
pub async fn listen(
tx: std::sync::mpsc::Sender<actix_web::dev::Server>,
address: &str,
@@ -42,23 +58,28 @@ impl Api {
info!("http api now listening at {}", address);
- let _ = tx.send(server.clone());
+ tx.send(server.clone()).unwrap();
sys.block_on(server)
}
}
+/// # Panics
+/// - A panic may occur if the mpsc sender is unable to send a clone of the
+/// server.
+#[must_use]
pub fn make() -> tokio::task::JoinHandle<()> {
// actix_web::rt::System::new("").block_on(rx.recv().unwrap().stop(true));
tokio::spawn(async move {
- let _ = crate::Api::listen(
+ crate::Api::listen(
std::sync::mpsc::channel().0,
&*format!(
"0.0.0.0:{}",
whirl_config::Config::get().whirlsplash.api.port
),
)
- .await;
+ .await
+ .unwrap();
})
}