diff rust/hg-core/src/operations/debugdata.rs @ 46503: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 3e2d539d0d1a
children b274aa2f20fd
line wrap: on
line diff
--- a/rust/hg-core/src/operations/debugdata.rs	Tue Jan 26 19:07:24 2021 +0100
+++ b/rust/hg-core/src/operations/debugdata.rs	Tue Jan 26 20:05:37 2021 +0100
@@ -16,9 +16,10 @@
 }
 
 /// Error type for `debug_data`
-#[derive(Debug)]
+#[derive(Debug, derive_more::From)]
 pub enum DebugDataError {
     /// Error when reading a `revlog` file.
+    #[from]
     IoError(std::io::Error),
     /// The revision has not been found.
     InvalidRevision,
@@ -32,12 +33,6 @@
     UnknowRevlogDataFormat(u8),
 }
 
-impl From<std::io::Error> for DebugDataError {
-    fn from(err: std::io::Error) -> Self {
-        DebugDataError::IoError(err)
-    }
-}
-
 impl From<RevlogError> for DebugDataError {
     fn from(err: RevlogError) -> Self {
         match err {