From c903c52f85a6b54f4561072b98ad8122e0410410 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Wed, 11 Dec 2024 10:11:03 +0900 Subject: [PATCH] Make clippy 1.83 happy --- src/git/commit.rs | 2 +- src/hg_bundle.rs | 10 +++++----- src/hg_connect.rs | 2 +- src/logging.rs | 8 ++++---- src/main.rs | 8 ++++---- src/store.rs | 2 +- src/version_check.rs | 4 ++-- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/git/commit.rs b/src/git/commit.rs index b2c332636..fff9539c4 100644 --- a/src/git/commit.rs +++ b/src/git/commit.rs @@ -65,7 +65,7 @@ pub struct Commit<'a> { body: &'a [u8], } -impl<'a> Commit<'a> { +impl Commit<'_> { pub fn parents(&self) -> &[CommitId] { &self.parents[..] } diff --git a/src/hg_bundle.rs b/src/hg_bundle.rs index 1f7403602..afdeb0dc2 100644 --- a/src/hg_bundle.rs +++ b/src/hg_bundle.rs @@ -278,7 +278,7 @@ impl<'a> Iterator for RevDiffIter<'a> { } } -impl<'a> RevDiffPart<'a> { +impl RevDiffPart<'_> { pub fn start(&self) -> usize { self.0.start } @@ -605,7 +605,7 @@ pub struct BundlePartReader<'a> { remaining: Option<&'a mut u32>, } -impl<'a> Read for BundlePartReader<'a> { +impl Read for BundlePartReader<'_> { fn read(&mut self, buf: &mut [u8]) -> io::Result { match self.version { BundleVersion::V1 => { @@ -707,7 +707,7 @@ impl<'a> BundleWriter<'a> { } } -impl<'a> Drop for BundleWriter<'a> { +impl Drop for BundleWriter<'_> { fn drop(&mut self) { if self.version == BundleVersion::V2 { write_bundle2_chunk(&mut *self.writer, &[]).unwrap(); @@ -741,7 +741,7 @@ impl<'a, const CHUNK_SIZE: usize> BundlePartWriter<'a, CHUNK_SIZE> { } } -impl<'a, const CHUNK_SIZE: usize> Drop for BundlePartWriter<'a, CHUNK_SIZE> { +impl Drop for BundlePartWriter<'_, CHUNK_SIZE> { fn drop(&mut self) { self.flush_buf_as_chunk().unwrap(); if self.bundle2_buf.is_some() { @@ -751,7 +751,7 @@ impl<'a, const CHUNK_SIZE: usize> Drop for BundlePartWriter<'a, CHUNK_SIZE> { } } -impl<'a, const CHUNK_SIZE: usize> Write for BundlePartWriter<'a, CHUNK_SIZE> { +impl Write for BundlePartWriter<'_, CHUNK_SIZE> { fn write(&mut self, mut buf: &[u8]) -> io::Result { if let Some(bundle2_buf) = self.bundle2_buf.as_mut() { let full_len = buf.len(); diff --git a/src/hg_connect.rs b/src/hg_connect.rs index 02c76cef4..e822da934 100644 --- a/src/hg_connect.rs +++ b/src/hg_connect.rs @@ -44,7 +44,7 @@ pub enum HgArgValue<'a> { ChangesetArray(&'a [HgChangesetId]), } -impl<'a> HgArgValue<'a> { +impl HgArgValue<'_> { pub fn as_string(&self) -> Cow { match self { HgArgValue::String(s) => Cow::Borrowed(s), diff --git a/src/logging.rs b/src/logging.rs index 45feed6c9..051fca11d 100644 --- a/src/logging.rs +++ b/src/logging.rs @@ -411,7 +411,7 @@ impl<'a, R: Read> LoggingReader<'a, R> { } } -impl<'a, R: Read> Read for LoggingReader<'a, R> { +impl Read for LoggingReader<'_, R> { fn read(&mut self, buf: &mut [u8]) -> std::io::Result { self.reader.read(buf).map(|l| { self.log.log(&buf[..l]); @@ -420,7 +420,7 @@ impl<'a, R: Read> Read for LoggingReader<'a, R> { } } -impl<'a, R: BufRead> BufRead for LoggingReader<'a, R> { +impl BufRead for LoggingReader<'_, R> { fn fill_buf(&mut self) -> std::io::Result<&[u8]> { self.reader.fill_buf() } @@ -444,7 +444,7 @@ impl<'a, R: BufRead> BufRead for LoggingReader<'a, R> { } } -impl<'a, R: ExactSizeReadRewind> ExactSizeReadRewind for LoggingReader<'a, R> { +impl ExactSizeReadRewind for LoggingReader<'_, R> { fn len(&self) -> std::io::Result { self.reader.len() } @@ -483,7 +483,7 @@ impl<'a, W: Write> LoggingWriter<'a, W> { } } -impl<'a, W: Write> Write for LoggingWriter<'a, W> { +impl Write for LoggingWriter<'_, W> { fn write(&mut self, buf: &[u8]) -> std::io::Result { self.writer.write(buf).map(|l| { self.log.log(&buf[..l]); diff --git a/src/main.rs b/src/main.rs index 91a8056db..c2d3e9fd3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2357,7 +2357,7 @@ struct ManifestLine<'a> { path_len: usize, } -impl<'a> ManifestLine<'a> { +impl ManifestLine<'_> { fn path(&self) -> &[u8] { &self.line[..self.path_len] } @@ -2376,19 +2376,19 @@ impl<'a> From<&'a [u8]> for ManifestLine<'a> { } } -impl<'a> PartialOrd for ManifestLine<'a> { +impl PartialOrd for ManifestLine<'_> { fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) } } -impl<'a> Ord for ManifestLine<'a> { +impl Ord for ManifestLine<'_> { fn cmp(&self, other: &Self) -> Ordering { self.path().cmp(other.path()) } } -impl<'a> Borrow<[u8]> for ManifestLine<'a> { +impl Borrow<[u8]> for ManifestLine<'_> { fn borrow(&self) -> &[u8] { self.path() } diff --git a/src/store.rs b/src/store.rs index 7e91289d8..57d37cf8e 100644 --- a/src/store.rs +++ b/src/store.rs @@ -686,7 +686,7 @@ pub struct HgChangeset<'a> { body: &'a [u8], } -impl<'a> HgChangeset<'a> { +impl HgChangeset<'_> { pub fn extra(&self) -> Option { self.extra.map(ChangesetExtra::from) } diff --git a/src/version_check.rs b/src/version_check.rs index 5f2d1b014..62b6953eb 100644 --- a/src/version_check.rs +++ b/src/version_check.rs @@ -43,7 +43,7 @@ impl<'a> From<&'a str> for VersionRequest<'a> { } } -impl<'a> Default for VersionRequest<'a> { +impl Default for VersionRequest<'_> { fn default() -> Self { if *BUILD_BRANCH == Release { VersionRequest::Tagged @@ -103,7 +103,7 @@ impl<'a> VersionRequestChild<'a> { } } -impl<'a> Deref for VersionRequestChild<'a> { +impl Deref for VersionRequestChild<'_> { type Target = SharedChild; fn deref(&self) -> &SharedChild { &self.child