From 2c4b51a5c306399b4cbc1b8fd92776a1cfdf32da Mon Sep 17 00:00:00 2001 From: Rain Date: Fri, 29 Nov 2024 01:17:48 +0000 Subject: [PATCH] [clippy] fixes for Rust 1.83 --- cargo-nextest/src/output.rs | 8 ++++---- nextest-filtering/tests/match.rs | 2 +- nextest-runner/src/config/archive.rs | 4 ++-- nextest-runner/src/config/scripts.rs | 2 +- nextest-runner/src/config/test_helpers.rs | 2 +- nextest-runner/src/config/test_threads.rs | 2 +- nextest-runner/src/config/threads_required.rs | 2 +- nextest-runner/src/helpers.rs | 2 +- nextest-runner/src/list/display_filter.rs | 2 +- nextest-runner/src/reporter/displayer.rs | 2 +- nextest-runner/src/reporter/helpers.rs | 2 +- nextest-runner/src/reporter/structured/libtest.rs | 2 +- nextest-runner/src/runner.rs | 2 +- nextest-runner/src/rustc_cli.rs | 2 +- nextest-runner/src/test_filter.rs | 2 +- nextest-runner/src/update.rs | 2 +- 16 files changed, 20 insertions(+), 20 deletions(-) diff --git a/cargo-nextest/src/output.rs b/cargo-nextest/src/output.rs index b06f98eeeef..68e497fbcbd 100644 --- a/cargo-nextest/src/output.rs +++ b/cargo-nextest/src/output.rs @@ -188,7 +188,7 @@ struct MessageVisitor<'writer, 'a> { error: Option, } -impl<'writer, 'a> Visit for MessageVisitor<'writer, 'a> { +impl Visit for MessageVisitor<'_, '_> { fn record_debug(&mut self, field: &Field, value: &dyn fmt::Debug) { if field.name() == MESSAGE_FIELD { if let Err(error) = write!(self.writer, "{:?}", value) { @@ -385,7 +385,7 @@ pub(crate) enum StdoutWriter<'a> { Test { buf: &'a mut Vec }, } -impl<'a> Write for StdoutWriter<'a> { +impl Write for StdoutWriter<'_> { fn write(&mut self, data: &[u8]) -> std::io::Result { match self { Self::Normal { buf, .. } => buf.write(data), @@ -403,7 +403,7 @@ impl<'a> Write for StdoutWriter<'a> { } } -impl<'a> WriteStr for StdoutWriter<'a> { +impl WriteStr for StdoutWriter<'_> { fn write_str(&mut self, s: &str) -> io::Result<()> { match self { Self::Normal { buf, .. } => buf.write_all(s.as_bytes()), @@ -430,7 +430,7 @@ pub(crate) enum StderrWriter<'a> { Test { buf: &'a mut Vec }, } -impl<'a> Write for StderrWriter<'a> { +impl Write for StderrWriter<'_> { fn write(&mut self, data: &[u8]) -> std::io::Result { match self { Self::Normal { buf, .. } => buf.write(data), diff --git a/nextest-filtering/tests/match.rs b/nextest-filtering/tests/match.rs index 6003c909e27..6b0497f537d 100644 --- a/nextest-filtering/tests/match.rs +++ b/nextest-filtering/tests/match.rs @@ -48,7 +48,7 @@ struct BinaryQueryCreator<'a> { platform: BuildPlatform, } -impl<'a> BinaryQueryCreator<'a> { +impl BinaryQueryCreator<'_> { fn to_query(&self) -> BinaryQuery<'_> { BinaryQuery { package_id: self.package_id, diff --git a/nextest-runner/src/config/archive.rs b/nextest-runner/src/config/archive.rs index 2c14f87db71..466a492aeca 100644 --- a/nextest-runner/src/config/archive.rs +++ b/nextest-runner/src/config/archive.rs @@ -88,7 +88,7 @@ impl<'de> Deserialize<'de> for ArchiveIncludeOnMissing { { struct ArchiveIncludeOnMissingVisitor; - impl<'de> serde::de::Visitor<'de> for ArchiveIncludeOnMissingVisitor { + impl serde::de::Visitor<'_> for ArchiveIncludeOnMissingVisitor { type Value = ArchiveIncludeOnMissing; fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { @@ -174,7 +174,7 @@ impl<'de> Deserialize<'de> for RecursionDepth { { struct RecursionDepthVisitor; - impl<'de> serde::de::Visitor<'de> for RecursionDepthVisitor { + impl serde::de::Visitor<'_> for RecursionDepthVisitor { type Value = RecursionDepth; fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { diff --git a/nextest-runner/src/config/scripts.rs b/nextest-runner/src/config/scripts.rs index 95a005c7903..67be1256c55 100644 --- a/nextest-runner/src/config/scripts.rs +++ b/nextest-runner/src/config/scripts.rs @@ -145,7 +145,7 @@ pub(crate) struct SetupScript<'profile> { pub(crate) compiled: Vec<&'profile CompiledProfileScripts>, } -impl<'profile> SetupScript<'profile> { +impl SetupScript<'_> { pub(crate) fn is_enabled(&self, test: &TestQuery<'_>, cx: &EvalContext<'_>) -> bool { self.compiled .iter() diff --git a/nextest-runner/src/config/test_helpers.rs b/nextest-runner/src/config/test_helpers.rs index 3890af1c7a7..189cd71241c 100644 --- a/nextest-runner/src/config/test_helpers.rs +++ b/nextest-runner/src/config/test_helpers.rs @@ -52,7 +52,7 @@ pub(super) struct BinaryQueryCreator<'a> { platform: BuildPlatform, } -impl<'a> BinaryQueryCreator<'a> { +impl BinaryQueryCreator<'_> { pub(super) fn to_query(&self) -> BinaryQuery<'_> { BinaryQuery { package_id: self.package_id, diff --git a/nextest-runner/src/config/test_threads.rs b/nextest-runner/src/config/test_threads.rs index 2548588cda9..cc6808e6d01 100644 --- a/nextest-runner/src/config/test_threads.rs +++ b/nextest-runner/src/config/test_threads.rs @@ -63,7 +63,7 @@ impl<'de> Deserialize<'de> for TestThreads { { struct V; - impl<'de2> serde::de::Visitor<'de2> for V { + impl serde::de::Visitor<'_> for V { type Value = TestThreads; fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { diff --git a/nextest-runner/src/config/threads_required.rs b/nextest-runner/src/config/threads_required.rs index 0c8b057e99d..39e849b91f9 100644 --- a/nextest-runner/src/config/threads_required.rs +++ b/nextest-runner/src/config/threads_required.rs @@ -36,7 +36,7 @@ impl<'de> Deserialize<'de> for ThreadsRequired { { struct V; - impl<'de2> serde::de::Visitor<'de2> for V { + impl serde::de::Visitor<'_> for V { type Value = ThreadsRequired; fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { diff --git a/nextest-runner/src/helpers.rs b/nextest-runner/src/helpers.rs index a06db501416..64735dab6d9 100644 --- a/nextest-runner/src/helpers.rs +++ b/nextest-runner/src/helpers.rs @@ -296,7 +296,7 @@ pub(crate) fn display_nt_status(nt_status: windows_sys::Win32::Foundation::NTSTA #[derive(Copy, Clone, Debug)] pub(crate) struct QuotedDisplay<'a, T: ?Sized>(pub(crate) &'a T); -impl<'a, T: ?Sized> fmt::Display for QuotedDisplay<'a, T> +impl fmt::Display for QuotedDisplay<'_, T> where T: fmt::Display, { diff --git a/nextest-runner/src/list/display_filter.rs b/nextest-runner/src/list/display_filter.rs index 4cbcbd7560f..d5be97f12e9 100644 --- a/nextest-runner/src/list/display_filter.rs +++ b/nextest-runner/src/list/display_filter.rs @@ -39,7 +39,7 @@ pub(crate) enum DisplayFilterMatcher<'list, 'filter> { Some(&'filter HashSet<&'list str>), } -impl<'list, 'filter> DisplayFilterMatcher<'list, 'filter> { +impl DisplayFilterMatcher<'_, '_> { pub(crate) fn is_match(&self, test_name: &str) -> bool { match self { Self::All => true, diff --git a/nextest-runner/src/reporter/displayer.rs b/nextest-runner/src/reporter/displayer.rs index a346ad2fea1..1314ee2ae55 100644 --- a/nextest-runner/src/reporter/displayer.rs +++ b/nextest-runner/src/reporter/displayer.rs @@ -1534,7 +1534,7 @@ impl<'a> TestReporterImpl<'a> { } } -impl<'a> fmt::Debug for TestReporter<'a> { +impl fmt::Debug for TestReporter<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("TestReporter") .field("stdout", &"BufferWriter { .. }") diff --git a/nextest-runner/src/reporter/helpers.rs b/nextest-runner/src/reporter/helpers.rs index d3bf2e13f43..99bba6ba0fe 100644 --- a/nextest-runner/src/reporter/helpers.rs +++ b/nextest-runner/src/reporter/helpers.rs @@ -497,7 +497,7 @@ some more text at the end, followed by some newlines"#, #[derive(Eq, PartialEq)] struct DisplayWrapper<'a>(&'a [u8]); - impl<'a> fmt::Debug for DisplayWrapper<'a> { + impl fmt::Debug for DisplayWrapper<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", String::from_utf8_lossy(self.0)) } diff --git a/nextest-runner/src/reporter/structured/libtest.rs b/nextest-runner/src/reporter/structured/libtest.rs index 759694dd628..dd47cd7caea 100644 --- a/nextest-runner/src/reporter/structured/libtest.rs +++ b/nextest-runner/src/reporter/structured/libtest.rs @@ -576,7 +576,7 @@ fn strip_human_stdout_or_combined( /// struct EscapedString<'s>(&'s str); -impl<'s> std::fmt::Display for EscapedString<'s> { +impl std::fmt::Display for EscapedString<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> ::std::fmt::Result { let mut start = 0; let s = self.0; diff --git a/nextest-runner/src/runner.rs b/nextest-runner/src/runner.rs index 6a34cef770d..2adffe5335e 100644 --- a/nextest-runner/src/runner.rs +++ b/nextest-runner/src/runner.rs @@ -2306,7 +2306,7 @@ struct ContextTestInstance<'a> { req_tx: UnboundedSender, } -impl<'a> ContextTestInstance<'a> { +impl ContextTestInstance<'_> { fn attempt_failed_will_retry(&mut self, run_status: ExecuteStatus) { self.past_attempts.push(run_status); } diff --git a/nextest-runner/src/rustc_cli.rs b/nextest-runner/src/rustc_cli.rs index f311e6a21e4..bc0241367d3 100644 --- a/nextest-runner/src/rustc_cli.rs +++ b/nextest-runner/src/rustc_cli.rs @@ -72,7 +72,7 @@ impl<'a> RustcCli<'a> { } } -impl<'a> Default for RustcCli<'a> { +impl Default for RustcCli<'_> { fn default() -> Self { Self { rustc_path: rustc_path(), diff --git a/nextest-runner/src/test_filter.rs b/nextest-runner/src/test_filter.rs index a236bf76bcf..2206383d4cd 100644 --- a/nextest-runner/src/test_filter.rs +++ b/nextest-runner/src/test_filter.rs @@ -561,7 +561,7 @@ pub struct TestFilter<'builder> { partitioner: Option>, } -impl<'filter> TestFilter<'filter> { +impl TestFilter<'_> { /// Returns an enum describing the match status of this filter. pub fn filter_match( &mut self, diff --git a/nextest-runner/src/update.rs b/nextest-runner/src/update.rs index dbf17e7c6ea..536e37bc77b 100644 --- a/nextest-runner/src/update.rs +++ b/nextest-runner/src/update.rs @@ -297,7 +297,7 @@ pub struct MuktiUpdateContext<'a> { pub perform_setup: bool, } -impl<'a> MuktiUpdateContext<'a> { +impl MuktiUpdateContext<'_> { /// Performs the update. pub fn do_update(&self) -> Result<(), UpdateError> { // This method is adapted from self_update's update_extended.