From: Ian Jackson Date: Thu, 31 Mar 2022 20:05:08 +0000 (+0100) Subject: clippy: Miscellaneous minor changes X-Git-Tag: otter-1.0.0~21 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=a578cee1d13092d0416850fec8bc473fd6d6c4ef;p=otter.git clippy: Miscellaneous minor changes Signed-off-by: Ian Jackson --- diff --git a/daemon/main.rs b/daemon/main.rs index 3e7b36ba..6e2a9573 100644 --- a/daemon/main.rs +++ b/daemon/main.rs @@ -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 { - 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")?; } diff --git a/daemon/session.rs b/daemon/session.rs index 9587b579..b1376db9 100644 --- a/daemon/session.rs +++ b/daemon/session.rs @@ -255,7 +255,7 @@ fn session_inner(form: Json, }; 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)?) } diff --git a/daemon/sse.rs b/daemon/sse.rs index ca1b7e09..57c7c189 100644 --- a/daemon/sse.rs +++ b/daemon/sse.rs @@ -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() }