From: Dessalines Date: Thu, 11 Nov 2021 12:18:08 +0000 (-0500) Subject: Adding clippy:unwrap to husky. Fixes #1892 (#1893) X-Git-Url: http://these/git/%22https:/image.com/%22%7B%7D/static/%24%7B%60data:application/manifest%20json;base64%2C%24%7Bawait?a=commitdiff_plain;h=8d4c4fdf6cfd849983744eaa2a7047bed91570b8;p=lemmy.git Adding clippy:unwrap to husky. Fixes #1892 (#1893) --- diff --git a/.cargo-husky/hooks/pre-commit b/.cargo-husky/hooks/pre-commit index 03ecb0fc..1e3fa431 100755 --- a/.cargo-husky/hooks/pre-commit +++ b/.cargo-husky/hooks/pre-commit @@ -5,6 +5,8 @@ cargo +nightly fmt -- --check cargo clippy --workspace --tests --all-targets --all-features -- \ -D warnings -D deprecated -D clippy::perf -D clippy::complexity -D clippy::dbg_macro +cargo clippy --workspace -- \ + -D clippy::unwrap_used ./scripts/update_config_defaults.sh git add config/defaults.hjson diff --git a/crates/apub/src/http/routes.rs b/crates/apub/src/http/routes.rs index eb9a5595..ea54cd48 100644 --- a/crates/apub/src/http/routes.rs +++ b/crates/apub/src/http/routes.rs @@ -69,7 +69,10 @@ impl Guard for InboxRequestGuard { return false; } if let Some(val) = request.headers.get("Content-Type") { - return val.to_str().unwrap().starts_with("application/"); + return val + .to_str() + .expect("Content-Type header contains non-ascii chars.") + .starts_with("application/"); } false }