Mercurial > public > mercurial-scm > hg-stable
diff rust/hg-core/src/revlog/node.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 | 645ee7225fab |
children | 43d63979a75e |
line wrap: on
line diff
--- a/rust/hg-core/src/revlog/node.rs Tue Jan 26 19:07:24 2021 +0100 +++ b/rust/hg-core/src/revlog/node.rs Tue Jan 26 20:05:37 2021 +0100 @@ -49,7 +49,7 @@ /// the size or return an error at runtime. /// /// [`nybbles_len`]: #method.nybbles_len -#[derive(Copy, Clone, Debug, PartialEq, BytesCast)] +#[derive(Copy, Clone, Debug, PartialEq, BytesCast, derive_more::From)] #[repr(transparent)] pub struct Node { data: NodeData, @@ -60,12 +60,6 @@ data: [0; NODE_BYTES_LENGTH], }; -impl From<NodeData> for Node { - fn from(data: NodeData) -> Node { - Node { data } - } -} - /// Return an error if the slice has an unexpected length impl<'a> TryFrom<&'a [u8]> for &'a Node { type Error = ();