From 11dab9c6f51aa11ae3bfb8ee09e08c95d7c206b5 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Wed, 10 Nov 2021 18:09:15 -0500 Subject: [PATCH] Adding clippy:unwrap to husky. Fixes #1892 --- .cargo-husky/hooks/pre-commit | 2 ++ crates/apub/src/http/routes.rs | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.cargo-husky/hooks/pre-commit b/.cargo-husky/hooks/pre-commit index 03ecb0fc2..1e3fa4316 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 eb9a5595c..ea54cd482 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 }