From 80ec7ab1d069b6c03d8210e0d1ee82aeeb48c85c Mon Sep 17 00:00:00 2001 From: Scott Lamb Date: Thu, 6 May 2021 09:47:07 -0700 Subject: [PATCH] cleanup some awkward Option call chains --- server/src/cmds/login.rs | 2 +- server/src/cmds/run.rs | 2 +- server/src/web.rs | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/server/src/cmds/login.rs b/server/src/cmds/login.rs index 109e591..82dcf11 100644 --- a/server/src/cmds/login.rs +++ b/server/src/cmds/login.rs @@ -76,7 +76,7 @@ pub fn run(args: &Args) -> Result { let (sid, _) = l.make_session( creation, uid, - args.domain.as_ref().map(|d| d.as_bytes().to_owned()), + args.domain.clone().map(String::into_bytes), flags, permissions, )?; diff --git a/server/src/cmds/run.rs b/server/src/cmds/run.rs index 353b573..a38dd9c 100644 --- a/server/src/cmds/run.rs +++ b/server/src/cmds/run.rs @@ -260,7 +260,7 @@ pub async fn run(args: &Args) -> Result { let rotate_offset_sec = streamer::ROTATE_INTERVAL_SEC * i as i64 / streams as i64; let syncer = syncers.get(&sample_file_dir_id).unwrap(); let object_detector = match stream.type_ { - db::StreamType::SUB => object_detector.as_ref().map(|a| Arc::clone(a)), + db::StreamType::SUB => object_detector.clone(), _ => None, }; let mut streamer = streamer::Streamer::new( diff --git a/server/src/web.rs b/server/src/web.rs index c05ac9a..6efc69d 100644 --- a/server/src/web.rs +++ b/server/src/web.rs @@ -1062,9 +1062,9 @@ impl Service { .strftime("%FT%T") .map(|f| f.to_string()) .unwrap_or_else(|e| e.to_string()), - host.as_ref().map(|h| &*h), + host.as_deref(), &authreq.addr, - agent.as_ref().map(|a| &*a), + agent.as_deref(), self.is_secure(req) ), )) @@ -1465,7 +1465,7 @@ mod tests { /// Produces a `Cookie` header value. pub fn header(&self) -> String { - self.0.as_ref().map(|s| s.as_str()).unwrap_or("").to_owned() + self.0.clone().unwrap() } }