rust/hg-core/src/config/layer.rs
changeset 46435 2e2033081274
parent 46187 95d6f31e88db
child 46447 0cb1b02228a6
--- a/rust/hg-core/src/config/layer.rs	Tue Jan 26 19:07:24 2021 +0100
+++ b/rust/hg-core/src/config/layer.rs	Tue Jan 26 20:05:37 2021 +0100
@@ -226,7 +226,7 @@
     }
 }
 
-#[derive(Debug)]
+#[derive(Debug, derive_more::From)]
 pub enum ConfigError {
     Parse {
         origin: ConfigOrigin,
@@ -239,15 +239,10 @@
         io_error: std::io::Error,
     },
     /// Any IO error that isn't expected
+    #[from]
     IO(std::io::Error),
 }
 
-impl From<std::io::Error> for ConfigError {
-    fn from(e: std::io::Error) -> Self {
-        Self::IO(e)
-    }
-}
-
 fn make_regex(pattern: &'static str) -> Regex {
     Regex::new(pattern).expect("expected a valid regex")
 }