From dc1909d0733b7a13388220c6a6ef3a5d7e6c1b29 Mon Sep 17 00:00:00 2001 From: Scott Lamb Date: Fri, 3 Oct 2025 14:19:52 -0700 Subject: [PATCH] fix lifetime elision warnings --- server/base/lib.rs | 2 +- server/base/shutdown.rs | 2 +- server/base/time.rs | 6 +++--- server/db/db.rs | 2 +- server/db/signal.rs | 4 ++-- server/db/upgrade/v5_to_v6.rs | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/server/base/lib.rs b/server/base/lib.rs index 4ae621d..8a03923 100644 --- a/server/base/lib.rs +++ b/server/base/lib.rs @@ -30,7 +30,7 @@ impl Mutex { #[track_caller] #[inline] - pub fn lock(&self) -> std::sync::MutexGuard { + pub fn lock(&self) -> std::sync::MutexGuard<'_, T> { self.0.lock().expect(NOT_POISONED) } diff --git a/server/base/shutdown.rs b/server/base/shutdown.rs index c1b0aee..9cc6d43 100644 --- a/server/base/shutdown.rs +++ b/server/base/shutdown.rs @@ -85,7 +85,7 @@ impl Receiver { } } - pub fn as_future(&self) -> ReceiverRefFuture { + pub fn as_future(&self) -> ReceiverRefFuture<'_> { ReceiverRefFuture { receiver: self, waker_i: NO_WAKER, diff --git a/server/base/time.rs b/server/base/time.rs index 6116fed..3a2bf01 100644 --- a/server/base/time.rs +++ b/server/base/time.rs @@ -55,7 +55,7 @@ fn fixed_len_num<'a, T: FromStr>(len: usize) -> impl FnMut(&'a str) -> IResult<' } /// Parses `YYYY-mm-dd` into pieces. -fn parse_datepart(input: &str) -> IResult<&str, (i16, i8, i8)> { +fn parse_datepart(input: &str) -> IResult<'_, &str, (i16, i8, i8)> { tuple(( fixed_len_num(4), preceded(tag("-"), fixed_len_num(2)), @@ -64,7 +64,7 @@ fn parse_datepart(input: &str) -> IResult<&str, (i16, i8, i8)> { } /// Parses `HH:MM[:SS[:FFFFF]]` into pieces. -fn parse_timepart(input: &str) -> IResult<&str, (i8, i8, i8, i32)> { +fn parse_timepart(input: &str) -> IResult<'_, &str, (i8, i8, i8, i32)> { let (input, (hr, _, min)) = tuple((fixed_len_num(2), tag(":"), fixed_len_num(2)))(input)?; let (input, stuff) = opt(tuple(( preceded(tag(":"), fixed_len_num(2)), @@ -75,7 +75,7 @@ fn parse_timepart(input: &str) -> IResult<&str, (i8, i8, i8, i32)> { } /// Parses `Z` (UTC) or `{+,-,}HH:MM` into a time zone offset in seconds. -fn parse_zone(input: &str) -> IResult<&str, i32> { +fn parse_zone(input: &str) -> IResult<'_, &str, i32> { alt(( nom::combinator::value(0, tag("Z")), map( diff --git a/server/db/db.rs b/server/db/db.rs index 849323d..363a6f5 100644 --- a/server/db/db.rs +++ b/server/db/db.rs @@ -2417,7 +2417,7 @@ impl Database { /// Locks the database; the returned reference is the only way to perform (read or write) /// operations. - pub fn lock(&self) -> DatabaseGuard { + pub fn lock(&self) -> DatabaseGuard<'_, C> { let timer = clock::TimerGuard::new(&self.clocks, acquisition); let db = self.db.as_ref().unwrap().lock(); drop(timer); diff --git a/server/db/signal.rs b/server/db/signal.rs index 6300362..99af035 100644 --- a/server/db/signal.rs +++ b/server/db/signal.rs @@ -81,12 +81,12 @@ impl Point { } /// Returns an iterator over state as of immediately before this point. - fn prev(&self) -> PointDataIterator { + fn prev(&self) -> PointDataIterator<'_> { PointDataIterator::new(&self.data[0..self.changes_off]) } /// Returns an iterator over changes in this point. - fn changes(&self) -> PointDataIterator { + fn changes(&self) -> PointDataIterator<'_> { PointDataIterator::new(&self.data[self.changes_off..]) } diff --git a/server/db/upgrade/v5_to_v6.rs b/server/db/upgrade/v5_to_v6.rs index 64b4f28..27b804c 100644 --- a/server/db/upgrade/v5_to_v6.rs +++ b/server/db/upgrade/v5_to_v6.rs @@ -27,7 +27,7 @@ fn default_pixel_aspect_ratio(width: u16, height: u16) -> (u16, u16) { (1, 1) } -fn parse(data: &[u8]) -> Result { +fn parse(data: &[u8]) -> Result, Error> { if data.len() < 94 || &data[4..8] != b"avc1" || &data[90..94] != b"avcC" { bail!( DataLoss,