Skip to content

Commit

Permalink
Merge pull request #156 from abonander/slice-fix
Browse files Browse the repository at this point in the history
fix `FmtConst` for `[u8]`
  • Loading branch information
abonander committed Jul 5, 2019
2 parents 7b415a4 + 12b4fde commit 56ff009
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion phf_shared/src/lib.rs
Expand Up @@ -88,7 +88,6 @@ macro_rules! delegate_debug(
);

delegate_debug!(str);
delegate_debug!([u8]);
delegate_debug!(char);
delegate_debug!(u8);
delegate_debug!(i8);
Expand Down Expand Up @@ -144,6 +143,14 @@ impl PhfHash for [u8] {
}
}

impl FmtConst for [u8] {
#[inline]
fn fmt_const(&self, f: &mut fmt::Formatter) -> fmt::Result {
// slices need a leading reference
write!(f, "&{:?}", self)
}
}

#[cfg(feature = "unicase")]
impl<S> PhfHash for unicase::UniCase<S>
where unicase::UniCase<S>: Hash {
Expand Down

0 comments on commit 56ff009

Please sign in to comment.