--- a/rust/rhg/src/error.rs Tue Jan 26 19:07:24 2021 +0100
+++ b/rust/rhg/src/error.rs Tue Jan 26 20:05:37 2021 +0100
@@ -8,13 +8,14 @@
use std::path::PathBuf;
/// The kind of command error
-#[derive(Debug)]
+#[derive(Debug, derive_more::From)]
pub enum CommandError {
/// The root of the repository cannot be found
RootNotFound(PathBuf),
/// The current directory cannot be found
CurrentDirNotFound(std::io::Error),
/// `.hg/requires`
+ #[from]
RequirementsError(RequirementsError),
/// The standard output stream cannot be written to
StdoutError,
@@ -93,9 +94,3 @@
}
}
}
-
-impl From<RequirementsError> for CommandError {
- fn from(err: RequirementsError) -> Self {
- CommandError::RequirementsError(err)
- }
-}