Mercurial > public > mercurial-scm > hg
diff rust/rhg/src/commands/root.rs @ 45363:5dbf875b3275
rhg: simplify `FindRootError` handling
Differential Revision: https://phab.mercurial-scm.org/D8867
author | Antoine Cezar <antoine.cezar@octobus.net> |
---|---|
date | Wed, 29 Jul 2020 15:49:44 +0200 |
parents | 47997afadf08 |
children | ed95ccc94333 |
line wrap: on
line diff
--- a/rust/rhg/src/commands/root.rs Wed Jul 29 10:26:17 2020 +0200 +++ b/rust/rhg/src/commands/root.rs Wed Jul 29 15:49:44 2020 +0200 @@ -1,7 +1,7 @@ use crate::commands::Command; -use crate::error::{CommandError, CommandErrorKind}; +use crate::error::CommandError; use crate::ui::Ui; -use hg::operations::{FindRoot, FindRootErrorKind}; +use hg::operations::FindRoot; use hg::utils::files::get_bytes_from_path; pub const HELP_TEXT: &str = " @@ -22,15 +22,7 @@ impl<'a> Command<'a> for RootCommand<'a> { fn run(&self) -> Result<(), CommandError> { - let path_buf = - FindRoot::new().run().map_err(|err| match err.kind { - FindRootErrorKind::RootNotFound(path) => { - CommandErrorKind::RootNotFound(path) - } - FindRootErrorKind::GetCurrentDirError(e) => { - CommandErrorKind::CurrentDirNotFound(e) - } - })?; + let path_buf = FindRoot::new().run()?; let bytes = get_bytes_from_path(path_buf);