Be more ergonomic here
This commit is contained in:
parent
84249e3fb5
commit
a25f650ca0
2 changed files with 2 additions and 2 deletions
|
@ -25,7 +25,7 @@ pub trait ErrFromStr<T> {
|
||||||
|
|
||||||
impl<T, E: Error> ErrFromStr<T> for Result<T, E> {
|
impl<T, E: Error> ErrFromStr<T> for Result<T, E> {
|
||||||
fn err_from_str(self) -> Result<T, String> {
|
fn err_from_str(self) -> Result<T, String> {
|
||||||
self.map_err(|e| format!("{}", e.description()))
|
self.map_err(|e| e.description().to_string())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ pub struct KeyValue<K, V> {
|
||||||
impl<K, V> KeyValue<K, V> {
|
impl<K, V> KeyValue<K, V> {
|
||||||
|
|
||||||
pub fn new(k: K, v: V) -> KeyValue<K, V> {
|
pub fn new(k: K, v: V) -> KeyValue<K, V> {
|
||||||
KeyValue { k: k, v: v }
|
KeyValue { k, v }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn key(&self) -> &K {
|
pub fn key(&self) -> &K {
|
||||||
|
|
Loading…
Reference in a new issue