Skip to content

Commit

Permalink
Fix warnings new to Rust 1.83. (#981)
Browse files Browse the repository at this point in the history
  • Loading branch information
partim authored Dec 5, 2024
1 parent 24dea4e commit 8e28c53
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 14 deletions.
8 changes: 4 additions & 4 deletions src/collector/rrdp/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ impl<'a> SnapshotUpdate<'a> {
}
}

impl<'a> ProcessSnapshot for SnapshotUpdate<'a> {
impl ProcessSnapshot for SnapshotUpdate<'_> {
type Err = SnapshotError;

fn meta(
Expand Down Expand Up @@ -353,7 +353,7 @@ impl<'a> DeltaUpdate<'a> {
}
}

impl<'a> ProcessDelta for DeltaUpdate<'a> {
impl ProcessDelta for DeltaUpdate<'_> {
type Err = DeltaError;

fn meta(
Expand Down Expand Up @@ -523,7 +523,7 @@ impl<'a, R> RrdpDataRead<'a, R> {
}
}

impl<'a, R: io::Read> RrdpDataRead<'a, R> {
impl<R: io::Read> RrdpDataRead<'_, R> {
/// Reads the data into a vec.
pub fn read_all(mut self) -> Result<Vec<u8>, RrdpDataReadError> {
let mut content = Vec::new();
Expand All @@ -539,7 +539,7 @@ impl<'a, R: io::Read> RrdpDataRead<'a, R> {
}
}

impl<'a, R: io::Read> io::Read for RrdpDataRead<'a, R> {
impl<R: io::Read> io::Read for RrdpDataRead<'_, R> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize, io::Error> {
let res = match self.reader.read(buf) {
Ok(res) => res,
Expand Down
4 changes: 2 additions & 2 deletions src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ impl<'a, P> Run<'a, P> {
}
}

impl<'a, P: ProcessRun> Run<'a, P> {
impl<P: ProcessRun> Run<'_, P> {
/// Performs the validation run.
pub fn process(&mut self) -> Result<(), RunFailed> {
// If we don’t have any TALs, we ain’t got nothing to do.
Expand Down Expand Up @@ -1595,7 +1595,7 @@ enum Task<'a, P> {
Ca(CaTask<P>),
}

impl<'a, P> fmt::Debug for Task<'a, P> {
impl<P> fmt::Debug for Task<'_, P> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
Task::Tal(ref inner) => {
Expand Down
2 changes: 1 addition & 1 deletion src/payload/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ pub struct PubPointProcessor<'a> {
point_stale: Time,
}

impl<'a> ProcessPubPoint for PubPointProcessor<'a> {
impl ProcessPubPoint for PubPointProcessor<'_> {
fn repository_index(&mut self, repository_index: usize) {
self.pub_point.repository_index = Some(repository_index)
}
Expand Down
2 changes: 1 addition & 1 deletion src/rta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl<'a, 's> ValidateCa<'a, 's> {
}
}

impl<'a, 's> ProcessPubPoint for ValidateCa<'a, 's> {
impl ProcessPubPoint for ValidateCa<'_, '_> {
fn want(&self, uri: &uri::Rsync) -> Result<bool, Failed> {
Ok(uri.ends_with(".cer"))
}
Expand Down
1 change: 0 additions & 1 deletion src/rtr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ impl RtrStream {
target_os = "dragonfly",
target_os = "freebsd",
target_os = "linux",
target_os = "nacl"
))]
setsockopt(
fd, sockopt::TcpKeepIdle,
Expand Down
2 changes: 1 addition & 1 deletion src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ impl<'a> StoredPoint<'a> {
}
}

impl<'a> Iterator for StoredPoint<'a> {
impl Iterator for StoredPoint<'_> {
type Item = Result<StoredObject, ParseError>;

fn next(&mut self) -> Option<Self::Item> {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/fatal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ pub struct ReadDir<'a> {
iter: fs::ReadDir,
}

impl<'a> Iterator for ReadDir<'a> {
impl Iterator for ReadDir<'_> {
type Item = Result<DirEntry, Failed>;

fn next(&mut self) -> Option<Self::Item> {
Expand Down
6 changes: 3 additions & 3 deletions src/utils/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl JsonBuilder<'static> {
}
}

impl<'a> JsonBuilder<'a> {
impl JsonBuilder<'_> {
pub fn member_object<F: FnOnce(&mut JsonBuilder)>(
&mut self, key: impl fmt::Display, op: F
) {
Expand Down Expand Up @@ -150,9 +150,9 @@ impl<'a> JsonBuilder<'a> {
pub fn json_str(val: impl fmt::Display) -> impl fmt::Display {
struct WriteJsonStr<'a, 'f>(&'a mut fmt::Formatter<'f>);

impl<'a, 'f> fmt::Write for WriteJsonStr<'a, 'f> {
impl fmt::Write for WriteJsonStr<'_, '_> {
fn write_str(&mut self, mut s: &str) -> fmt::Result {
while let Some(idx) = s.find(|ch| ch == '"' || ch == '\\') {
while let Some(idx) = s.find(['"', '\\']) {
self.0.write_str(&s[..idx])?;
self.0.write_str("\\")?;
write!(self.0, "{}", char::from(s.as_bytes()[idx]))?;
Expand Down

0 comments on commit 8e28c53

Please sign in to comment.