Implement From<DispatchError> for '&static str (#4856)

This commit is contained in:
Shawn Tabrizi
2020-02-07 16:25:20 +01:00
committed by GitHub
parent ec562fe937
commit 164f620918
+7 -7
View File
@@ -405,13 +405,13 @@ impl From<&'static str> for DispatchError {
}
}
impl Into<&'static str> for DispatchError {
fn into(self) -> &'static str {
match self {
Self::Other(msg) => msg,
Self::CannotLookup => "Can not lookup",
Self::BadOrigin => "Bad origin",
Self::Module { message, .. } => message.unwrap_or("Unknown module error"),
impl From<DispatchError> for &'static str {
fn from(err: DispatchError) -> &'static str {
match err {
DispatchError::Other(msg) => msg,
DispatchError::CannotLookup => "Can not lookup",
DispatchError::BadOrigin => "Bad origin",
DispatchError::Module { message, .. } => message.unwrap_or("Unknown module error"),
}
}
}