From 7f749e6c6d5695f11d5aa6d442eee4abe992025a Mon Sep 17 00:00:00 2001 From: ddidderr Date: Sun, 14 Apr 2024 08:30:35 +0200 Subject: [PATCH] [clippy] enable more lints, get rid of unwrap --- Cargo.toml | 8 ++++++++ src/main.rs | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f562068..de3fc29 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,14 @@ name = "expose-dir-via-http" version = "1.0.0" edition = "2021" +[lints.rust] +unsafe_code = "forbid" + +[lints.clippy] +pedantic = "warn" +todo = "warn" +unwrap_used = "warn" + [dependencies] actix-web = { version = "4", features = ["experimental-io-uring"] } actix-files = "0.6" diff --git a/src/main.rs b/src/main.rs index f5f5903..43de022 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,6 @@ use std::{ - env, net::{IpAddr, SocketAddr}, + num::NonZeroUsize, thread::available_parallelism, }; @@ -39,7 +39,7 @@ async fn main() -> std::io::Result<()> { .prefer_utf8(true), ) }) - .workers(available_parallelism().unwrap().get()) + .workers(available_parallelism().map_or(1, NonZeroUsize::get)) .bind(sock)? .run() .await