Loosen up argument type on unexpected::Error::from

This commit is contained in:
Brian Picciano 2024-01-25 02:01:17 +01:00
parent 5f1f8ce1b7
commit 142fc14916

View File

@ -42,8 +42,11 @@ impl Error {
return Error::from_displays(prefix, &e, e.source());
}
pub fn from(s: &str) -> Error {
Error::from_displays(None::<String>, s, None::<String>)
pub fn from<S>(s: S) -> Error
where
S: AsRef<str>,
{
Error::from_displays(None::<String>, s.as_ref(), None::<String>)
}
}