chiark / gitweb /
clippy: Miscellaneous minor changes
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 31 Mar 2022 19:09:22 +0000 (20:09 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 31 Mar 2022 19:09:22 +0000 (20:09 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/updates.rs
src/utils.rs

index eb46d394e86eccf50c63743d56d4a884e63f84b1..a9d87f3be284f86837d2fb4070c4baf048289ffb 100644 (file)
@@ -634,7 +634,6 @@ impl<'r> PrepareUpdatesBuffer<'r> {
         (Some(gpc), Some(ipc)) => {
           let pri = piece_pri(ioccults, &gs.occults, player,
                               gpl, piece, gpc, ipc);
-          drop(gpl);
           with_max_z(&mut gs.max_z, gpc);
           mk_update(ioccults,gs,gpc,ipc,player,&pri)?
         },
@@ -961,10 +960,10 @@ impl Vec<(PieceId, PieceUpdateOps)> {
   }
 }
 
-impl<'u> Into<FormattedLogEntry<'u>> for TransmitUpdateLogEntry<'u> {
-  fn into(self) -> FormattedLogEntry<'u> {
-    let (tz, logent) = self;
-    let when = logent.when.render(&tz);
+impl<'u> From<TransmitUpdateLogEntry<'u>> for FormattedLogEntry<'u> {
+  fn from(tule: TransmitUpdateLogEntry<'u>) -> FormattedLogEntry<'u> {
+    let (tz, logent) = tule;
+    let when = logent.when.render(tz);
     FormattedLogEntry { when, logent: &logent.logent }
   }
 }
index d6030d0f35a0ab874221cbda1d8796c7388685b5..310d0772e75e1858a2525d739dde20b5884a591d 100644 (file)
@@ -48,6 +48,7 @@ pub struct OldNew<T>([T; 2]);
 #[derive(Hash,Eq,PartialEq)]
 pub enum OldNewIndex { Old, New }
 
+#[allow(clippy::new_ret_no_self)]
 impl<T> OldNew<T> {
   pub fn old(&self) -> &T { &self.0[0] }
   pub fn new(&self) -> &T { &self.0[1] }
@@ -74,6 +75,7 @@ impl<T> OldNew<T> {
     self.0.iter()
   }
 
+  #[allow(clippy::should_implement_trait)] // yes, but, TAIT
   pub fn into_iter(self) -> impl Iterator<Item=T> {
     IntoIterator::into_iter(self.0)
   }
@@ -187,13 +189,13 @@ pub mod timespec_serde {
 
   #[throws(S::Error)]
   pub fn serialize<S:Serializer>(v: &TimeSpec, s: S) -> S::Ok {
-    let v = Timespec(v.tv_sec().into(), v.tv_nsec().try_into().unwrap());
+    let v = Timespec(v.tv_sec(), v.tv_nsec().try_into().unwrap());
     Serialize::serialize(&v, s)?
   }
   #[throws(D::Error)]
   pub fn deserialize<'de, D:Deserializer<'de>>(d: D) -> TimeSpec {
     let Timespec(sec, nsec) = Deserialize::deserialize(d)?;
-    libc::timespec { tv_sec: sec.into(), tv_nsec: nsec.into() }.into()
+    libc::timespec { tv_sec: sec, tv_nsec: nsec.into() }.into()
   }
 }
 
@@ -662,9 +664,11 @@ impl<W:Write> Write for SigPipeWriter<W> {
 }
 
 pub type RawStdout = SigPipeWriter<io::Stdout>;
+#[allow(clippy::new_without_default)] // Don't want these made willy-nilly
 impl RawStdout { pub fn new() -> Self { SigPipeWriter(io::stdout()) } }
 
 pub struct CookedStdout(pub BufWriter<SigPipeWriter<io::Stdout>>);
+#[allow(clippy::new_without_default)] // Don't want these made willy-nilly
 impl CookedStdout {
   pub fn new() -> Self { Self(BufWriter::new(RawStdout::new())) }
   fn handle_err(e: io::Error) -> ! {