mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-01-25 21:53:16 -05:00
cleanup some awkward Option call chains
This commit is contained in:
parent
33e8359b01
commit
80ec7ab1d0
@ -76,7 +76,7 @@ pub fn run(args: &Args) -> Result<i32, Error> {
|
||||
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,
|
||||
)?;
|
||||
|
@ -260,7 +260,7 @@ pub async fn run(args: &Args) -> Result<i32, Error> {
|
||||
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(
|
||||
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user