chiark / gitweb /
clippy: Miscellaneous minor changes
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 31 Mar 2022 20:05:08 +0000 (21:05 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 31 Mar 2022 20:05:08 +0000 (21:05 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
daemon/main.rs
daemon/session.rs
daemon/sse.rs

index 3e7b36ba4a959d07ca8b8f3925e33fbdd302621b..6e2a957353458820854b5005cd9aaf870537a3cf 100644 (file)
@@ -44,6 +44,7 @@ const CT_GZIP: &str = "application/gzip";
 const CT_WASM: &str = "application/wasm";
 
 trait IntoMime: Debug {
+  #[allow(clippy::wrong_self_convention)]
   fn into_mime(&self) -> mime::Mime;
 }
 impl IntoMime for &str {
@@ -130,11 +131,10 @@ struct UnknownResource;
 impl FromStr for CheckedResourceLeaf {
   type Err = UnknownResource;
   fn from_str(s: &str) -> Result<Self, Self::Err> {
-    for &(safe_leaf, locn, ref ctype) in RESOURCES {
+    for &(safe_leaf, locn, ctype) in RESOURCES {
       if safe_leaf == s {
         return Ok(CheckedResourceLeaf {
-          safe_leaf, locn,
-          ctype: ctype.clone(),
+          safe_leaf, locn, ctype,
         });
       }
     }
@@ -481,19 +481,19 @@ async fn main() -> Result<(),StartupError> {
 
   let opts = Opts::from_args();
 
-  ServerConfig::read(opts.config_filename.as_ref().map(String::as_str),
+  ServerConfig::read(opts.config_filename.as_deref(),
                      PathResolveMethod::Chdir)?;
 
   let c = config();
 
-  flexi_logger::Logger::with(log_config().clone()).start()?;
+  flexi_logger::Logger::with(log_config()).start()?;
 
   debug!("resolved config: {:#?}", c);
 
   if c.check_bundled_sources {
     let check = format!("{}/otter/index.html", &c.bundled_sources);
     fs::metadata(&check)
-      .context(check.clone())
+      .context(check)
       .context("check bundled-sources directory")?;
   }
 
index 9587b579d28a0c81104ea9b2dd230bc9d464d367..b1376db92b9af7186970de1ea5c8bcfb29b2ad51 100644 (file)
@@ -255,7 +255,7 @@ fn session_inner(form: Json<SessionForm>,
   };
   info!("rendering /_/session for {:?} {:?} {:?} {:?} {:?}",
         &player, client, &c.nick, &c.ctoken,
-        iad.gref.lock().ok().as_ref().map(|ig| &**ig));
+        iad.gref.lock().ok().as_deref());
 
   Ok(templates.render(layout.template(),&c)?)
 }
index ca1b7e09511d28a09eb79f5d7627706dca43a343..57c7c1893baa6b587fba1aba4767ec4b8ab8abac 100644 (file)
@@ -162,7 +162,7 @@ impl UpdateReader {
         }
       };
 
-      self.wn.write_next(&mut buf, &iplayer.ipl.tz, &next)
+      self.wn.write_next(&mut buf, &iplayer.ipl.tz, next)
         .map_err(|e| self.wn.trouble("UpdateReader.write_next",&e))?;
 
       if buf.len() >= UPDATE_READER_SIZE { return buf.finish() }