Mercurial > hg
diff rust/hg-core/src/revlog/nodemap.rs @ 46428:5893706af3de
rust: Simplify error type for reading hex node IDs
If a string is not valid hexadecimal it’s not that useful to track the precise reason.
Differential Revision: https://phab.mercurial-scm.org/D9861
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Mon, 25 Jan 2021 12:28:39 +0100 |
parents | 0800aa42bb4c |
children | 645ee7225fab |
line wrap: on
line diff
--- a/rust/hg-core/src/revlog/nodemap.rs Mon Jan 25 12:00:23 2021 +0100 +++ b/rust/hg-core/src/revlog/nodemap.rs Mon Jan 25 12:28:39 2021 +0100 @@ -13,7 +13,7 @@ //! is used in a more abstract context. use super::{ - node::NULL_NODE, Node, NodeError, NodePrefix, NodePrefixRef, Revision, + node::NULL_NODE, FromHexError, Node, NodePrefix, NodePrefixRef, Revision, RevlogIndex, NULL_REVISION, }; @@ -27,14 +27,14 @@ #[derive(Debug, PartialEq)] pub enum NodeMapError { MultipleResults, - InvalidNodePrefix(NodeError), + InvalidNodePrefix, /// A `Revision` stored in the nodemap could not be found in the index RevisionNotInIndex(Revision), } -impl From<NodeError> for NodeMapError { - fn from(err: NodeError) -> Self { - NodeMapError::InvalidNodePrefix(err) +impl From<FromHexError> for NodeMapError { + fn from(_: FromHexError) -> Self { + NodeMapError::InvalidNodePrefix } }