chore: remove AsRef impl from the StringLiteral macro since I don't like that behavior, reorganize it to prevent leaking proc-macro2 / syn / quote

This commit is contained in:
J / Jacob Babich
2026-07-12 13:54:57 -04:00
parent 3e063901be
commit 3f94015b4f
7 changed files with 94 additions and 89 deletions

View File

@@ -11,11 +11,11 @@ pub struct WrongLiteralError<S> {
impl<S> Display for WrongLiteralError<S>
where
S: AsRef<str>,
&'static str: for<'a> From<&'a S>,
{
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let Self { actual, expected } = self;
let expected_str = expected.as_ref();
let expected_str = <&'static str>::from(&expected);
write!(f, "expected {expected_str:?} but got {actual:?}")
}