chiark / gitweb /
clippy: Miscellaneous minor changes
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 30 Mar 2022 23:38:13 +0000 (00:38 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 30 Mar 2022 23:59:17 +0000 (00:59 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
base/geometry.rs
base/html.rs
base/zcoord.rs
wasm/wasm.rs

index 9d2385a788eaecf4a747829e422473b1eb171332..2228eadc2254be7fe81eab87e47d5ae262f188df 100644 (file)
@@ -127,6 +127,7 @@ impl<T> PosC<T> 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<T> PosC<T> {
   #[throws(PosCFromIteratorError)]
   pub fn from_iter<I: Iterator<Item=T>>(i: I) -> Self { PosC{ coords:
index 7f8f7b22e5505b85302a4dbaa95aefdf8bd43c1d..304a7082852d8daa4d9d77628e92dd7aa99932af 100644 (file)
@@ -85,7 +85,7 @@ impl<'e, T:Display+'e> HtmlFormat<'e> for IsHtmlFormatted<T> {
 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 }
 }
index 85dcae17608aaa465bfafb641a2ff85e75d7bf5e..44a88396fde0e4da80ac3be2a5aff98924476310 100644 (file)
@@ -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)
       }),
     }
index 88dbd4b9bf0d007fb4c7b4efd07c82c2ef8c91c5..98c5249f8b0f2d63d3df68a1a738904e3073c710 100644 (file)
@@ -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;