chiark / gitweb /
clippy: Misc minor improvements
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 16 May 2022 01:36:32 +0000 (02:36 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 16 May 2022 02:09:35 +0000 (03:09 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
clippy-options
daemon/cmdlistener.rs
src/bin/otterlib.rs
src/fastsplit.rs
src/shapelib.rs

index 87cccb595d131be33222049db219d2b97c4f062d..99dd652e65a6c2e362c8db6790c461d167459693 100644 (file)
@@ -45,3 +45,4 @@
 -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
+-A clippy::neg_cmp_op_on_partial_ord
index 5c651cd245ee76cccd6503b926ee80fb320808c5..fd853d1a66856cd7b03b404e08ea86b63c58894a 100644 (file)
@@ -1023,7 +1023,7 @@ fn execute_game_insn<'cs, 'igr, 'ig: 'igr>(
                         |ioccults, goccults, ipc, gpc| {
           if let (Some(ipc), Some(gpc)) = (ipc, gpc) {
             let pri = PieceRenderInstructions::new_visible(default());
-            pri.describe(ioccults,goccults, gpc, &ipc)
+            pri.describe(ioccults,goccults, gpc, ipc)
           } else {
             "<piece partially missing from game state>".to_html()
           }
index ef66556bf15094cd585601cf56d0ca65ad5b47cf..8a0769cb08b87d38a0c1992768219d38dc3941e6 100644 (file)
@@ -217,7 +217,7 @@ fn preview(opts: &Opts, items: Vec<ItemForOutput>) {
                &viewport, wh[0], wh[1]);
         let mut html = Html::lit("").into();
         gpc.face = face.into();
-        p.svg_piece(&mut html, &gpc, &GameState::dummy(), default())?;
+        p.svg_piece(&mut html, gpc, &GameState::dummy(), default())?;
         println!("{}", html);
         if inseveral == 1 {
           let dasharray = player_num_dasharray(1.try_into().unwrap());
index cfe90c00acc0e48b230d67ef08fd7195ce141d79..472f934016e6e09b4f2432e6b8099cd1d822d2a4 100644 (file)
@@ -169,6 +169,7 @@ impl InstanceGuard<'_> {
   pub fn fastsplit_delete(&mut self,
                           show: ShowUnocculted,
                           piece: PieceId,
+                          #[allow(clippy::ptr_arg)]
                           _proof_that_caller_handles_logging: &Vec<LogEntry>)
                           -> (PieceUpdateOp<(),()>, UnpreparedUpdates)
   {
index a5ae6ba5d47c63b93de05c3a5028546036244712..43150defa0f941b438ab43ab0a3679dbdee80699 100644 (file)
@@ -751,7 +751,7 @@ impl GroupData {
 
       let osize = {
         let (osize, oscale) = self.d.outline.size_scale();
-        let osize = resolve_square_size(&osize)?;
+        let osize = resolve_square_size(osize)?;
         match (osize, oscale) {
           (Some(osize), None         ) => osize,
           (None,        Some(&oscale)) => (size * oscale)?,
@@ -766,7 +766,7 @@ impl GroupData {
 
     } else {
       let xform = FaceTransform::from_group_mf1(self)?;
-      let outline = self.d.outline.shape().load_mf1(&self)?;
+      let outline = self.d.outline.shape().load_mf1(self)?;
       (xform, outline)
     }
   }
@@ -998,7 +998,7 @@ pub fn load_catalogue(libname: &str, src: &mut dyn LibrarySource)
     // We do this here rather than in the files loop because
     //  1. we want to check it even if there are no files specified
     //  2. this is OK because the group doesn't change from here on
-    let shape_calculable = group.check_shape()?.into();
+    let shape_calculable = group.check_shape()?;
 
     if [
       group.d.flip,
@@ -1131,11 +1131,11 @@ impl<'i> Substituting<'i> {
     }
     let needle: Cow<str> = (move || Some({
       if let Some(rhs) = needle.strip_prefix("${") {
-        let token = rhs.strip_suffix("}")?;
-        if self.do_dollars() { needle.into() }
+        let token = rhs.strip_suffix('}')?;
+        if self.do_dollars() { needle }
         else { format!("_{}", token).into() }
-      } else if let Some(token) = needle.strip_prefix("_") {
-        if ! self.do_dollars() { needle.into() }
+      } else if let Some(token) = needle.strip_prefix('_') {
+        if ! self.do_dollars() { needle }
         else { format!("${{{}}}", token).into() }
       } else {
         return None
@@ -1352,7 +1352,7 @@ fn process_files_entry(
       PerhapsSubst::Y(s) => s,
     } }
     #[throws(SubstError)]
-    pub fn is_y(
+    pub fn into_of_y(
       self,
     ) -> Substituting<'i> { match self {
       PerhapsSubst::Y(s) => s,
@@ -1450,7 +1450,7 @@ fn process_files_entry(
         spec = substn(spec, format!("${{{}}}", k), v)?;
       }
       let spec = substn(spec, "${image}", &image_table)?;
-      let spec = c_colour_all(spec.into())?.is_y()?;
+      let spec = c_colour_all(spec.into())?.into_of_y()?;
       let spec = spec.finish()?;
       trace!("magic item {}\n\n{}\n", &item_name, &spec);