From c46832369a9ba61a8713f8b7df1fa627310b870d Mon Sep 17 00:00:00 2001 From: Scott Lamb Date: Wed, 22 Jan 2025 09:40:25 -0800 Subject: [PATCH] automated clippy fixes --- server/base/shutdown.rs | 2 +- server/db/db.rs | 6 +++--- server/db/recording.rs | 5 +---- server/db/writer.rs | 2 +- server/src/json.rs | 4 ++-- server/src/web/static_file.rs | 5 +---- 6 files changed, 9 insertions(+), 15 deletions(-) diff --git a/server/base/shutdown.rs b/server/base/shutdown.rs index fd6d88c..78011c1 100644 --- a/server/base/shutdown.rs +++ b/server/base/shutdown.rs @@ -139,7 +139,7 @@ fn poll_impl(inner: &Inner, waker_i: &mut usize, cx: &mut Context<'_>) -> Poll<( Poll::Pending } -impl<'receiver> Future for ReceiverRefFuture<'receiver> { +impl Future for ReceiverRefFuture<'_> { type Output = (); fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { diff --git a/server/db/db.rs b/server/db/db.rs index a4925bd..bc050dc 100644 --- a/server/db/db.rs +++ b/server/db/db.rs @@ -2444,7 +2444,7 @@ pub struct DatabaseGuard<'db, C: Clocks> { _timer: clock::TimerGuard<'db, C, &'static str, fn() -> &'static str>, } -impl<'db, C: Clocks + Clone> DatabaseGuard<'db, C> { +impl DatabaseGuard<'_, C> { /// Tries to flush unwritten changes from the stream directories. /// /// * commits any recordings added with `add_recording` that have since been marked as @@ -2459,14 +2459,14 @@ impl<'db, C: Clocks + Clone> DatabaseGuard<'db, C> { } } -impl<'db, C: Clocks + Clone> ::std::ops::Deref for DatabaseGuard<'db, C> { +impl ::std::ops::Deref for DatabaseGuard<'_, C> { type Target = LockedDatabase; fn deref(&self) -> &LockedDatabase { &self.db } } -impl<'db, C: Clocks + Clone> ::std::ops::DerefMut for DatabaseGuard<'db, C> { +impl ::std::ops::DerefMut for DatabaseGuard<'_, C> { fn deref_mut(&mut self) -> &mut LockedDatabase { &mut self.db } diff --git a/server/db/recording.rs b/server/db/recording.rs index 961deb4..55a5769 100644 --- a/server/db/recording.rs +++ b/server/db/recording.rs @@ -395,10 +395,7 @@ impl Segment { if let Err(e) = f(&it) { return Err(e); } - have_frame = match it.next(data) { - Err(e) => return Err(e), - Ok(hf) => hf, - }; + have_frame = it.next(data)?; } if key_frame < self.key_frames { bail!( diff --git a/server/db/writer.rs b/server/db/writer.rs index 4515386..d733c1c 100644 --- a/server/db/writer.rs +++ b/server/db/writer.rs @@ -985,7 +985,7 @@ impl InnerWriter { } } -impl<'a, C: Clocks + Clone, D: DirWriter> Drop for Writer<'a, C, D> { +impl Drop for Writer<'_, C, D> { fn drop(&mut self) { if ::std::thread::panicking() { // This will probably panic again. Don't do it. diff --git a/server/src/json.rs b/server/src/json.rs index 6a4ecb0..442a5ad 100644 --- a/server/src/json.rs +++ b/server/src/json.rs @@ -376,7 +376,7 @@ struct SignalDayValue<'a> { pub states: &'a [u64], } -impl<'a> TopLevel<'a> { +impl TopLevel<'_> { /// Serializes cameras as a list (rather than a map), optionally including the `days` and /// `cameras` fields. fn serialize_cameras( @@ -440,7 +440,7 @@ pub struct ListRecordings<'a> { pub video_sample_entries: (&'a db::LockedDatabase, Vec), } -impl<'a> ListRecordings<'a> { +impl ListRecordings<'_> { fn serialize_video_sample_entries( video_sample_entries: &(&db::LockedDatabase, Vec), serializer: S, diff --git a/server/src/web/static_file.rs b/server/src/web/static_file.rs index e402964..b04de93 100644 --- a/server/src/web/static_file.rs +++ b/server/src/web/static_file.rs @@ -129,10 +129,7 @@ impl<'a> StaticFileRequest<'a> { p => (p, true), }; - let last_dot = match path.rfind('.') { - None => return None, - Some(d) => d, - }; + let last_dot = path.rfind('.')?; let ext = &path[last_dot + 1..]; let mime = match ext { "css" => "text/css",