From: Ian Jackson Date: Wed, 30 Mar 2022 23:57:24 +0000 (+0100) Subject: zcoord: Move from_str impl for Mutable to be FromStr impl X-Git-Tag: otter-1.0.0~58 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=645bc0a060bab6435ac39db18d128009f331b347;p=otter.git zcoord: Move from_str impl for Mutable to be FromStr impl Suggested by clippy. Signed-off-by: Ian Jackson --- diff --git a/base/zcoord.rs b/base/zcoord.rs index ebdeda6f..dcee587d 100644 --- a/base/zcoord.rs +++ b/base/zcoord.rs @@ -493,9 +493,12 @@ impl Mutable { }), } } +} +impl FromStr for Mutable { + type Err = ParseError; #[throws(ParseError)] - pub fn from_str(s: &str) -> Mutable { + fn from_str(s: &str) -> Mutable { let tail = ZCoord::checked(s)?; Mutable::from_u8_unchecked(tail) } diff --git a/wasm/wasm.rs b/wasm/wasm.rs index 77f2bd5b..251ec7cb 100644 --- a/wasm/wasm.rs +++ b/wasm/wasm.rs @@ -8,6 +8,7 @@ use otter_base::imports::*; use std::fmt::Display; use std::collections::hash_map::HashMap; +use std::str::FromStr; use extend::ext; use fehler::throws;