From: Ian Jackson Date: Wed, 30 Mar 2022 23:38:13 +0000 (+0100) Subject: clippy: Miscellaneous minor changes X-Git-Tag: otter-1.0.0~63 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=0f8a1395ac3fb07d8adcc5907e7e7687233002ce;p=otter.git clippy: Miscellaneous minor changes Signed-off-by: Ian Jackson --- diff --git a/base/geometry.rs b/base/geometry.rs index 9d2385a7..2228eadc 100644 --- a/base/geometry.rs +++ b/base/geometry.rs @@ -127,6 +127,7 @@ impl PosC where T: Copy { pub fn y(self) -> T { self.coords[1] } } +#[allow(clippy::should_implement_trait)] // this one is fallible, which is a bit odd impl PosC { #[throws(PosCFromIteratorError)] pub fn from_iter>(i: I) -> Self { PosC{ coords: diff --git a/base/html.rs b/base/html.rs index 7f8f7b22..304a7082 100644 --- a/base/html.rs +++ b/base/html.rs @@ -85,7 +85,7 @@ impl<'e, T:Display+'e> HtmlFormat<'e> for IsHtmlFormatted { impl Html { pub fn new() -> Self { default() } pub fn from_txt(s: &str) -> Self { - Html(htmlescape::encode_minimal(&s)) + Html(htmlescape::encode_minimal(s)) } pub fn from_html_string(s: String) -> Self { Html(s) } @@ -100,6 +100,7 @@ impl HtmlStr { let s = unsafe { mem::transmute::<&'s str, &'s HtmlStr>(s) }; s } + #[allow(clippy::len_without_is_empty)] pub fn len(&self) -> usize { self.0.len() } pub fn as_html_str(&self) -> &str { &self.0 } } diff --git a/base/zcoord.rs b/base/zcoord.rs index 85dcae17..44a88396 100644 --- a/base/zcoord.rs +++ b/base/zcoord.rs @@ -138,7 +138,7 @@ impl LimbVal { /// return value is the top bits, shifted pub fn to_str_buf(self, out: &mut [Tail1; DIGITS_PER_LIMB]) -> LimbVal { let mut l = self; - for p in out.into_iter().rev() { + for p in out.iter_mut().rev() { let v = (l & DIGIT_MASK).primitive() as u8; *p = if v < 10 { b'0' + v } else { (b'a' - 10) + v }; l >>= BITS_PER_DIGIT; @@ -484,11 +484,11 @@ impl Mutable { match (a, b) { (None, None ) => throw!(TotallyUnboundedRange), (Some(a), None ) => mk( a.clone().iter(Increment).take(c) ), - (Some(a), Some(b)) => mk( Mutable::range_upto(&a,&b,count)? ), + (Some(a), Some(b)) => mk( Mutable::range_upto(a,b,count)? ), (None, Some(b)) => mk({ let mut first = b.clone(); first.addsub(&Decrement).unwrap(); - let (current, aso) = Mutable::range_core(&first, &b, count-1)?; + let (current, aso) = Mutable::range_core(&first, b, count-1)?; IteratorCore { current, aso, mr: MutateLast }.take(c) }), } diff --git a/wasm/wasm.rs b/wasm/wasm.rs index 88dbd4b9..98c5249f 100644 --- a/wasm/wasm.rs +++ b/wasm/wasm.rs @@ -2,6 +2,8 @@ // SPDX-License-Identifier: AGPL-3.0-or-later // There is NO WARRANTY. +#![allow(clippy::unused_unit)] // #[wasm_bindgen] produces these? + use otter_base::imports::*; use std::fmt::Display;