Skip to content

Commit

Permalink
Update message method so that its return value is Deref<&str>
Browse files Browse the repository at this point in the history
  • Loading branch information
JDSeiler authored and dginev committed Jul 18, 2023
1 parent 2d64295 commit 31d0819
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,8 @@ impl StructuredError {
/// reporting mechanism. Instead of calling this method, you can access the
/// StructuredError `message` field directly.
#[deprecated(since="0.3.3", note="Please use the `message` field directly instead.")]
pub fn message(&self) -> String {
self.message
.clone()
.unwrap_or("".to_string())
pub fn message(&self) -> &String {
self.message.as_ref().unwrap()
}

/// Returns the provided c_str as Some(String), or None if the provided pointer is null.
Expand Down

0 comments on commit 31d0819

Please sign in to comment.