Skip to content

Commit 1045057

Browse files
aj3nniklasad1
andauthored
refactor: make ErrorObject::borrowed accept &str (#1160)
* make ErrorObject::borrowed accept DST message type * Update types/src/error.rs * Update types/src/error.rs --------- Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
1 parent ad9dab3 commit 1045057

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

types/src/error.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ impl<'a> ErrorObject<'a> {
7373
}
7474

7575
/// Create a new [`ErrorObject`] with optional data.
76-
pub fn borrowed(code: i32, message: &'a impl AsRef<str>, data: Option<&'a RawValue>) -> ErrorObject<'a> {
77-
ErrorObject { code: code.into(), message: StdCow::Borrowed(message.as_ref()), data: data.map(StdCow::Borrowed) }
76+
pub fn borrowed(code: i32, message: &'a str, data: Option<&'a RawValue>) -> ErrorObject<'a> {
77+
ErrorObject { code: code.into(), message: StdCow::Borrowed(message), data: data.map(StdCow::Borrowed) }
7878
}
7979

8080
/// Take ownership of the parameters within, if we haven't already.

0 commit comments

Comments
 (0)