From 8d4c4fdf6cfd849983744eaa2a7047bed91570b8 Mon Sep 17 00:00:00 2001
From: Dessalines <dessalines@users.noreply.github.com>
Date: Thu, 11 Nov 2021 07:18:08 -0500
Subject: [PATCH] Adding clippy:unwrap to husky. Fixes #1892 (#1893)

---
 .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 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
   }
-- 
2.44.1