From 142fc14916c25bc2db7609d9ac850fa870714424 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Thu, 25 Jan 2024 02:01:17 +0100 Subject: [PATCH] Loosen up argument type on unexpected::Error::from --- src/error/unexpected.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/error/unexpected.rs b/src/error/unexpected.rs index 71e82fc..28f4801 100644 --- a/src/error/unexpected.rs +++ b/src/error/unexpected.rs @@ -42,8 +42,11 @@ impl Error { return Error::from_displays(prefix, &e, e.source()); } - pub fn from(s: &str) -> Error { - Error::from_displays(None::, s, None::) + pub fn from(s: S) -> Error + where + S: AsRef, + { + Error::from_displays(None::, s.as_ref(), None::) } }