Mercurial > public > mercurial-scm > hg-stable
diff rust/hg-core/src/utils/hg_path.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 | 2d5dfc8fed55 |
children | 6c778d20c8c2 |
line wrap: on
line diff
--- a/rust/hg-core/src/utils/hg_path.rs Tue Jan 26 19:07:24 2021 +0100 +++ b/rust/hg-core/src/utils/hg_path.rs Tue Jan 26 20:05:37 2021 +0100 @@ -367,7 +367,9 @@ } } -#[derive(Default, Eq, Ord, Clone, PartialEq, PartialOrd, Hash)] +#[derive( + Default, Eq, Ord, Clone, PartialEq, PartialOrd, Hash, derive_more::From, +)] pub struct HgPathBuf { inner: Vec<u8>, } @@ -408,12 +410,6 @@ } } -impl From<Vec<u8>> for HgPathBuf { - fn from(vec: Vec<u8>) -> Self { - Self { inner: vec } - } -} - impl<T: ?Sized + AsRef<HgPath>> From<&T> for HgPathBuf { fn from(s: &T) -> HgPathBuf { s.as_ref().to_owned()