Be more ergonomic here

This commit is contained in:
Matthias Beyer 2018-04-24 21:04:33 +02:00
parent 84249e3fb5
commit a25f650ca0
2 changed files with 2 additions and 2 deletions

View file

@ -25,7 +25,7 @@ pub trait ErrFromStr<T> {
impl<T, E: Error> ErrFromStr<T> for Result<T, E> {
fn err_from_str(self) -> Result<T, String> {
self.map_err(|e| format!("{}", e.description()))
self.map_err(|e| e.description().to_string())
}
}

View file

@ -33,7 +33,7 @@ pub struct KeyValue<K, V> {
impl<K, 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 {