Mercurial > public > mercurial-scm > hg
diff rust/hg-core/src/lib.rs @ 52301:79e8118cd846
rust-lib: move `Dirstate*Error` to the `dirstate` module
That's where they belong and should always have been there.
author | Rapha?l Gom?s <rgomes@octobus.net> |
---|---|
date | Mon, 04 Nov 2024 11:18:36 +0100 |
parents | 04b9a56c2d25 |
children | f33b87b46135 |
line wrap: on
line diff
--- a/rust/hg-core/src/lib.rs Mon Nov 04 11:13:05 2024 +0100 +++ b/rust/hg-core/src/lib.rs Mon Nov 04 11:18:36 2024 +0100 @@ -42,7 +42,7 @@ pub mod utils; pub mod vfs; -use crate::utils::hg_path::{HgPathBuf, HgPathError}; +use crate::utils::hg_path::HgPathError; pub use filepatterns::{ parse_pattern_syntax_kind, read_pattern_file, IgnorePattern, PatternFileWarning, PatternSyntax, @@ -67,50 +67,6 @@ pub type FastHashbrownMap<K, V> = hashbrown::HashMap<K, V, RandomXxHashBuilder64>; -#[derive(Debug, PartialEq)] -pub enum DirstateMapError { - PathNotFound(HgPathBuf), - InvalidPath(HgPathError), -} - -impl From<HgPathError> for DirstateMapError { - fn from(error: HgPathError) -> Self { - Self::InvalidPath(error) - } -} - -impl fmt::Display for DirstateMapError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - DirstateMapError::PathNotFound(_) => { - f.write_str("expected a value, found none") - } - DirstateMapError::InvalidPath(path_error) => path_error.fmt(f), - } - } -} - -#[derive(Debug, derive_more::From)] -pub enum DirstateError { - Map(DirstateMapError), - Common(errors::HgError), -} - -impl From<HgPathError> for DirstateError { - fn from(error: HgPathError) -> Self { - Self::Map(DirstateMapError::InvalidPath(error)) - } -} - -impl fmt::Display for DirstateError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - DirstateError::Map(error) => error.fmt(f), - DirstateError::Common(error) => error.fmt(f), - } - } -} - #[derive(Debug, derive_more::From)] pub enum PatternError { #[from]