diff --git a/deny.toml b/deny.toml index 54336d3..b3e00dd 100644 --- a/deny.toml +++ b/deny.toml @@ -35,7 +35,6 @@ external-default-features = "allow" allow = [] deny = [] skip = [ - { crate = "sync_wrapper@0.1.2", reason = "tower has not upgraded to 1.0 yet" }, { crate = "windows-sys@0.52.0", reason = "gix pulls in two separate versions" }, ] skip-tree = [ diff --git a/flake.nix b/flake.nix index bb80678..d9a8317 100644 --- a/flake.nix +++ b/flake.nix @@ -48,6 +48,7 @@ ./statics ./templates ./themes + ./deny.toml ./build.rs ]; }; @@ -75,7 +76,7 @@ clippy = craneLib.cargoClippy buildArgs; doc = craneLib.cargoDoc buildArgs; audit = craneLib.cargoAudit { inherit advisory-db; src = cargoOnlySrc; }; - deny = craneLib.cargoDeny { src = cargoOnlySrc; }; + deny = craneLib.cargoDeny { inherit src; }; test = craneLib.cargoNextest (buildArgs // { partitions = 1; partitionType = "count"; diff --git a/src/methods/filters.rs b/src/methods/filters.rs index 83a4bce..2724abe 100644 --- a/src/methods/filters.rs +++ b/src/methods/filters.rs @@ -3,6 +3,7 @@ use std::{ borrow::Borrow, + fmt::Display, sync::{Arc, LazyLock}, }; @@ -40,8 +41,18 @@ pub fn file_perms(s: &u16) -> Result { Ok(unix_mode::to_string(u32::from(*s))) } -pub fn hex(s: &[u8]) -> Result { - Ok(const_hex::encode(s)) +pub struct DisplayHexBuffer(const_hex::Buffer); + +impl Display for DisplayHexBuffer { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(self.0.as_str()) + } +} + +pub fn hex(s: &[u8; 20]) -> Result, askama::Error> { + let mut buf = const_hex::Buffer::new(); + buf.format(s); + Ok(DisplayHexBuffer(buf)) } pub fn gravatar(email: &str) -> Result<&'static str, askama::Error> {