diff --git a/crates/smol_str/src/lib.rs b/crates/smol_str/src/lib.rs index 4d5fef5932..41c3a39ef8 100644 --- a/crates/smol_str/src/lib.rs +++ b/crates/smol_str/src/lib.rs @@ -1,6 +1,6 @@ -use std::{sync::Arc, ops::Deref}; +use std::{sync::Arc, ops::Deref, fmt}; -#[derive(Clone, Debug)] +#[derive(Clone)] pub struct SmolStr(Repr); impl SmolStr { @@ -49,6 +49,18 @@ impl<'a> PartialEq for &'a str { } } +impl fmt::Debug for SmolStr { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Debug::fmt(self.as_str(), f) + } +} + +impl fmt::Display for SmolStr { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(self.as_str(), f) + } +} + const INLINE_CAP: usize = 22; const WS_TAG: u8 = (INLINE_CAP + 1) as u8;