From f4fa448c91bfedabc1f82b00d62f9d5a75e906f5 Mon Sep 17 00:00:00 2001 From: MrCroxx Date: Tue, 8 Oct 2024 07:08:34 +0000 Subject: [PATCH 1/5] refactor: make clippy happy with nightly-20241008 Signed-off-by: MrCroxx --- fastrace/src/util/object_pool.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/fastrace/src/util/object_pool.rs b/fastrace/src/util/object_pool.rs index 7ac67dd2..57ae6a79 100644 --- a/fastrace/src/util/object_pool.rs +++ b/fastrace/src/util/object_pool.rs @@ -109,25 +109,27 @@ impl<'a, T> Reusable<'a, T> { } } -impl<'a, T> std::fmt::Debug for Reusable<'a, T> -where T: std::fmt::Debug +impl std::fmt::Debug for Reusable<'_, T> +where + T: std::fmt::Debug, { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { self.obj.fmt(f) } } -impl<'a, T> std::cmp::PartialEq for Reusable<'a, T> -where T: std::cmp::PartialEq +impl std::cmp::PartialEq for Reusable<'_, T> +where + T: std::cmp::PartialEq, { fn eq(&self, other: &Self) -> bool { T::eq(self, other) } } -impl<'a, T> std::cmp::Eq for Reusable<'a, T> where T: std::cmp::Eq {} +impl std::cmp::Eq for Reusable<'_, T> where T: std::cmp::Eq {} -impl<'a, T> Deref for Reusable<'a, T> { +impl Deref for Reusable<'_, T> { type Target = T; #[inline] @@ -136,14 +138,14 @@ impl<'a, T> Deref for Reusable<'a, T> { } } -impl<'a, T> DerefMut for Reusable<'a, T> { +impl DerefMut for Reusable<'_, T> { #[inline] fn deref_mut(&mut self) -> &mut Self::Target { &mut self.obj } } -impl<'a, T> Drop for Reusable<'a, T> { +impl Drop for Reusable<'_, T> { #[inline] fn drop(&mut self) { unsafe { From 318bb900c986380a6fdafe091985b4e97cb29c9b Mon Sep 17 00:00:00 2001 From: MrCroxx Date: Wed, 9 Oct 2024 07:09:32 +0000 Subject: [PATCH 2/5] chore: temp disable clippy falst positive check Signed-off-by: MrCroxx --- fastrace/examples/asynchronous.rs | 2 ++ fastrace/examples/synchronous.rs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/fastrace/examples/asynchronous.rs b/fastrace/examples/asynchronous.rs index 98146609..8013421d 100644 --- a/fastrace/examples/asynchronous.rs +++ b/fastrace/examples/asynchronous.rs @@ -36,6 +36,8 @@ async fn other_job() { } } +// FIXME: Remove `expect` after the issue is fixed. https://github.com/rust-lang/rust-clippy/issues/13458 +#[expect(clippy::needless_return)] #[tokio::main] async fn main() { fastrace::set_reporter(ReportAll::new(), Config::default()); diff --git a/fastrace/examples/synchronous.rs b/fastrace/examples/synchronous.rs index bd5bce8e..ed6fdef9 100644 --- a/fastrace/examples/synchronous.rs +++ b/fastrace/examples/synchronous.rs @@ -21,6 +21,8 @@ fn func2(i: u64) { std::thread::sleep(Duration::from_millis(i)); } +// FIXME: Remove `expect` after the issue is fixed. https://github.com/rust-lang/rust-clippy/issues/13458 +#[expect(clippy::needless_return)] #[tokio::main] async fn main() { fastrace::set_reporter(ReportAll::new(), Config::default()); From 1c4b18c0eee9d1898c153637ed3fe5be483d8a0e Mon Sep 17 00:00:00 2001 From: MrCroxx Date: Wed, 9 Oct 2024 07:12:21 +0000 Subject: [PATCH 3/5] chore: pass fmt Signed-off-by: MrCroxx --- fastrace/src/util/object_pool.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fastrace/src/util/object_pool.rs b/fastrace/src/util/object_pool.rs index 57ae6a79..b0a0650a 100644 --- a/fastrace/src/util/object_pool.rs +++ b/fastrace/src/util/object_pool.rs @@ -110,8 +110,7 @@ impl<'a, T> Reusable<'a, T> { } impl std::fmt::Debug for Reusable<'_, T> -where - T: std::fmt::Debug, +where T: std::fmt::Debug { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { self.obj.fmt(f) @@ -119,8 +118,7 @@ where } impl std::cmp::PartialEq for Reusable<'_, T> -where - T: std::cmp::PartialEq, +where T: std::cmp::PartialEq { fn eq(&self, other: &Self) -> bool { T::eq(self, other) From 233cb0aa24f1061ae0aaad9dbceff4e7aa599a40 Mon Sep 17 00:00:00 2001 From: MrCroxx Date: Wed, 9 Oct 2024 07:19:17 +0000 Subject: [PATCH 4/5] fix: disable expect on stable Signed-off-by: MrCroxx --- fastrace/Cargo.toml | 2 ++ fastrace/examples/asynchronous.rs | 2 +- fastrace/examples/synchronous.rs | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/fastrace/Cargo.toml b/fastrace/Cargo.toml index 6e17685b..26774697 100644 --- a/fastrace/Cargo.toml +++ b/fastrace/Cargo.toml @@ -47,6 +47,8 @@ opentelemetry-otlp = { version = "0.25", features = ["trace"] } opentelemetry_sdk = { version = "0.25", features = ["trace"] } rand = "0.8" rustracing = "0.6" +# FIXME: Remove `rustversion` dep after the issue is fixed. https://github.com/rust-lang/rust-clippy/issues/13458 +rustversion = "1" serial_test = "3.1" test-harness = "0.3" tokio = { version = "1.38", features = [ diff --git a/fastrace/examples/asynchronous.rs b/fastrace/examples/asynchronous.rs index 8013421d..19ac64f1 100644 --- a/fastrace/examples/asynchronous.rs +++ b/fastrace/examples/asynchronous.rs @@ -37,7 +37,7 @@ async fn other_job() { } // FIXME: Remove `expect` after the issue is fixed. https://github.com/rust-lang/rust-clippy/issues/13458 -#[expect(clippy::needless_return)] +#[rustversion::attr(nightly, expect(clippy::needless_return))] #[tokio::main] async fn main() { fastrace::set_reporter(ReportAll::new(), Config::default()); diff --git a/fastrace/examples/synchronous.rs b/fastrace/examples/synchronous.rs index ed6fdef9..99e1aee3 100644 --- a/fastrace/examples/synchronous.rs +++ b/fastrace/examples/synchronous.rs @@ -22,7 +22,7 @@ fn func2(i: u64) { } // FIXME: Remove `expect` after the issue is fixed. https://github.com/rust-lang/rust-clippy/issues/13458 -#[expect(clippy::needless_return)] +#[rustversion::attr(nightly, expect(clippy::needless_return))] #[tokio::main] async fn main() { fastrace::set_reporter(ReportAll::new(), Config::default()); From 3ac8977c42627d672dfe6e1115722cf3ecf6cbec Mon Sep 17 00:00:00 2001 From: MrCroxx Date: Thu, 10 Oct 2024 06:28:07 +0000 Subject: [PATCH 5/5] chore: allow lint in manifest Signed-off-by: MrCroxx --- fastrace/Cargo.toml | 6 ++++-- fastrace/examples/asynchronous.rs | 2 -- fastrace/examples/synchronous.rs | 2 -- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/fastrace/Cargo.toml b/fastrace/Cargo.toml index 26774697..ecfb74a4 100644 --- a/fastrace/Cargo.toml +++ b/fastrace/Cargo.toml @@ -47,8 +47,6 @@ opentelemetry-otlp = { version = "0.25", features = ["trace"] } opentelemetry_sdk = { version = "0.25", features = ["trace"] } rand = "0.8" rustracing = "0.6" -# FIXME: Remove `rustversion` dep after the issue is fixed. https://github.com/rust-lang/rust-clippy/issues/13458 -rustversion = "1" serial_test = "3.1" test-harness = "0.3" tokio = { version = "1.38", features = [ @@ -77,3 +75,7 @@ name = "spsc" [[bench]] harness = false name = "object_pool" + +[lints.clippy] +# https://github.com/rust-lang/rust-clippy/issues/13458 +needless_return = "allow" diff --git a/fastrace/examples/asynchronous.rs b/fastrace/examples/asynchronous.rs index 19ac64f1..98146609 100644 --- a/fastrace/examples/asynchronous.rs +++ b/fastrace/examples/asynchronous.rs @@ -36,8 +36,6 @@ async fn other_job() { } } -// FIXME: Remove `expect` after the issue is fixed. https://github.com/rust-lang/rust-clippy/issues/13458 -#[rustversion::attr(nightly, expect(clippy::needless_return))] #[tokio::main] async fn main() { fastrace::set_reporter(ReportAll::new(), Config::default()); diff --git a/fastrace/examples/synchronous.rs b/fastrace/examples/synchronous.rs index 99e1aee3..bd5bce8e 100644 --- a/fastrace/examples/synchronous.rs +++ b/fastrace/examples/synchronous.rs @@ -21,8 +21,6 @@ fn func2(i: u64) { std::thread::sleep(Duration::from_millis(i)); } -// FIXME: Remove `expect` after the issue is fixed. https://github.com/rust-lang/rust-clippy/issues/13458 -#[rustversion::attr(nightly, expect(clippy::needless_return))] #[tokio::main] async fn main() { fastrace::set_reporter(ReportAll::new(), Config::default());