From: Ian Jackson Date: Wed, 30 Mar 2022 23:55:41 +0000 (+0100) Subject: zcoord: Move from_str impl to be (only) in FromStr impl X-Git-Tag: otter-1.0.0~59 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=df7b1258d03c0a6d742e9884206b54fa7a735974;p=otter.git zcoord: Move from_str impl to be (only) in FromStr impl Suggested by clippy. Signed-off-by: Ian Jackson --- diff --git a/base/zcoord.rs b/base/zcoord.rs index 7c7847a2..ebdeda6f 100644 --- a/base/zcoord.rs +++ b/base/zcoord.rs @@ -554,7 +554,10 @@ impl TryFrom<&str> for ZCoord { impl FromStr for ZCoord { type Err = ParseError; #[throws(ParseError)] - fn from_str(s: &str) -> ZCoord { ZCoord::from_str(s)? } + fn from_str(s: &str) -> ZCoord { + let tail = ZCoord::checked(s)?; + ZCoord::alloc_copy(tail).unwrap() + } } //---------- construction of ZCoord contents --------- @@ -598,12 +601,6 @@ impl ZCoord { pub fn check_str(s: &str) { Self::checked(s)?; } - - #[throws(ParseError)] - pub fn from_str(s: &str) -> Self { - let tail = ZCoord::checked(s)?; - ZCoord::alloc_copy(tail).unwrap() - } } impl TryFrom<&Mutable> for ZCoord {