diff rust/hg-core/src/config/layer.rs @ 46435:2e2033081274

rust: replace trivial `impl From …` with `#[derive(derive_more::From)]` Crate docs: https://jeltef.github.io/derive_more/derive_more/from.html Differential Revision: https://phab.mercurial-scm.org/D9875
author Simon Sapin <simon.sapin@octobus.net>
date Tue, 26 Jan 2021 20:05:37 +0100
parents 95d6f31e88db
children 0cb1b02228a6
line wrap: on
line diff
--- 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")
 }