From ef391ce50624bdfe219c10642441eb2fcad14ae7 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 1 May 2022 11:34:58 +0100 Subject: [PATCH] Miscellaneous cleanups prompted by clippy Signed-off-by: Ian Jackson --- base/geometry.rs | 1 + clippy-options | 4 ++++ src/bin/otterlib.rs | 3 +-- src/dice.rs | 4 ++-- src/shapelib.rs | 4 ++-- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/base/geometry.rs b/base/geometry.rs index 2228eadc..0552b3de 100644 --- a/base/geometry.rs +++ b/base/geometry.rs @@ -46,6 +46,7 @@ macro_rules! checked_inherent { {$n:ident($($formal:tt)*) $($actual:tt)*} => { } } } +#[allow(clippy::only_used_in_recursion)] // FP nightly (1bfe40d11 2022-03-18 impl CheckedArith for i32 { checked_inherent!{checked_add(, rhs: Self) rhs} checked_inherent!{checked_sub(, rhs: Self) rhs} diff --git a/clippy-options b/clippy-options index dfac5903..87cccb59 100644 --- a/clippy-options +++ b/clippy-options @@ -41,3 +41,7 @@ -A clippy::needless_update -A clippy::comparison_chain -A clippy::bool_comparison +-A clippy::nonminimal_bool +-A clippy::needless_match +-A clippy::from_over_into # buggy in 1.61.0-nightly (1bfe40d11 2022-03-18) +-A clippy::await_holding_lock # moans about synch mutex in async diff --git a/src/bin/otterlib.rs b/src/bin/otterlib.rs index 5d2da22f..f42f4e64 100644 --- a/src/bin/otterlib.rs +++ b/src/bin/otterlib.rs @@ -176,8 +176,7 @@ fn preview(items: Vec) { if face < (p.nfaces() as usize) { let viewport = [bbox[0].clone(), size.clone()] - .iter().cloned() - .flatten() + .iter().flatten().cloned() .map(|c| c.to_string()) .join(" "); let wh = size.iter().map(|&s| s * SVG_SCALE) diff --git a/src/dice.rs b/src/dice.rs index 8ea6c85d..b2597784 100644 --- a/src/dice.rs +++ b/src/dice.rs @@ -144,7 +144,7 @@ impl PieceSpec for Spec { let n = labels.len(); let n = n.try_into().map_err(|_| SpecError::FarTooManyFaces(n))?; set_nfaces(n, "labels")?; - labels.into() + labels } else { index_vec!["".into()] }; @@ -453,7 +453,7 @@ impl InertPieceTrait for Die { let tc = OverlayTemplateContext { - label_text: &label, + label_text: label, label_font_size, label_y_adjust: label_font_size * SVG_FONT_Y_ADJUST_OF_FONT_SIZE, diff --git a/src/shapelib.rs b/src/shapelib.rs index f1e6bef6..2ef4e32a 100644 --- a/src/shapelib.rs +++ b/src/shapelib.rs @@ -227,7 +227,7 @@ impl OutlineTrait for ItemInertForOcculted { delegate! { to self.outline { #[dyn_upcast] impl PieceBaseTrait for ItemInertForOcculted { fn nfaces(&self) -> RawFaceId { 1 } - fn itemname(&self) -> &str { &self.itemname.as_str() } + fn itemname(&self) -> &str { self.itemname.as_str() } } #[typetag::serde(name="Lib")] impl InertPieceTrait for ItemInertForOcculted { @@ -350,7 +350,7 @@ impl Item { let svgd = &self.svgs[face.svg]; face.xform.write_svgd(f, svgd)?; } else if let Some(back) = &self.back { - back.svg(f, vpid, default(), &xdata)?; + back.svg(f, vpid, default(), xdata)?; } else { throw!(internal_error_bydebug(&(self, face))) } -- 2.30.2