From 2feb1cff926cdb77f5ae894034715e4fe40abf2b Mon Sep 17 00:00:00 2001 From: Kirill Chibisov Date: Sat, 16 Sep 2023 23:04:35 +0400 Subject: [PATCH] Fix coverage testing on the CI The way coverage is enabled/disabled was changed upstream. Links: https://github.com/rust-lang/rust/pull/114656 --- src/error.rs | 4 ++-- src/io.rs | 2 +- src/lib.rs | 2 +- src/loop_logic.rs | 10 +++++----- src/sources/channel.rs | 4 ++-- src/sources/mod.rs | 4 ++-- src/sources/timer.rs | 4 ++-- src/sys.rs | 2 +- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/error.rs b/src/error.rs index 4191bfcb..7a6001b8 100644 --- a/src/error.rs +++ b/src/error.rs @@ -67,7 +67,7 @@ pub struct InsertError { } impl Debug for InsertError { - #[cfg_attr(feature = "nightly_coverage", no_coverage)] + #[cfg_attr(feature = "nightly_coverage", coverage(off))] fn fmt(&self, formatter: &mut Formatter) -> core::result::Result<(), fmt::Error> { write!(formatter, "{:?}", self.error) } @@ -76,7 +76,7 @@ impl Debug for InsertError { impl From> for crate::Error { /// Converts the [`InsertError`] into Calloop's error type, throwing away /// the contained source. - #[cfg_attr(feature = "nightly_coverage", no_coverage)] + #[cfg_attr(feature = "nightly_coverage", coverage(off))] fn from(e: InsertError) -> crate::Error { e.error } diff --git a/src/io.rs b/src/io.rs index 0cc8c5d5..bc10b252 100644 --- a/src/io.rs +++ b/src/io.rs @@ -42,7 +42,7 @@ pub struct Async<'l, F: AsFd> { } impl<'l, F: AsFd + std::fmt::Debug> std::fmt::Debug for Async<'l, F> { - #[cfg_attr(feature = "nightly_coverage", no_coverage)] + #[cfg_attr(feature = "nightly_coverage", coverage(off))] fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("Async").field("fd", &self.fd).finish() } diff --git a/src/lib.rs b/src/lib.rs index be3a9c72..5e27cbec 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -143,7 +143,7 @@ #![warn(missing_docs, missing_debug_implementations)] #![allow(clippy::needless_doctest_main)] #![cfg_attr(docsrs, feature(doc_cfg))] -#![cfg_attr(feature = "nightly_coverage", feature(no_coverage))] +#![cfg_attr(feature = "nightly_coverage", feature(coverage_attribute))] mod sys; diff --git a/src/loop_logic.rs b/src/loop_logic.rs index 2de60260..5793f666 100644 --- a/src/loop_logic.rs +++ b/src/loop_logic.rs @@ -83,14 +83,14 @@ pub struct LoopHandle<'l, Data> { } impl<'l, Data> std::fmt::Debug for LoopHandle<'l, Data> { - #[cfg_attr(feature = "nightly_coverage", no_coverage)] + #[cfg_attr(feature = "nightly_coverage", coverage(off))] fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.write_str("LoopHandle { ... }") } } impl<'l, Data> Clone for LoopHandle<'l, Data> { - #[cfg_attr(feature = "nightly_coverage", no_coverage)] + #[cfg_attr(feature = "nightly_coverage", coverage(off))] fn clone(&self) -> Self { LoopHandle { inner: self.inner.clone(), @@ -128,7 +128,7 @@ impl<'l, Data> LoopHandle<'l, Data> { /// Use this function if you need access to the event source after its insertion in the loop. /// /// See also `insert_source`. - #[cfg_attr(feature = "nightly_coverage", no_coverage)] // Contains a branch we can't hit w/o OOM + #[cfg_attr(feature = "nightly_coverage", coverage(off))] // Contains a branch we can't hit w/o OOM pub fn register_dispatcher( &self, dispatcher: Dispatcher<'l, S, Data>, @@ -282,7 +282,7 @@ pub struct EventLoop<'l, Data> { } impl<'l, Data> std::fmt::Debug for EventLoop<'l, Data> { - #[cfg_attr(feature = "nightly_coverage", no_coverage)] + #[cfg_attr(feature = "nightly_coverage", coverage(off))] fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.write_str("EventLoop { ... }") } @@ -659,7 +659,7 @@ pub struct LoopSignal { } impl std::fmt::Debug for LoopSignal { - #[cfg_attr(feature = "nightly_coverage", no_coverage)] + #[cfg_attr(feature = "nightly_coverage", coverage(off))] fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.write_str("LoopSignal { ... }") } diff --git a/src/sources/channel.rs b/src/sources/channel.rs index 94b27454..58e5e842 100644 --- a/src/sources/channel.rs +++ b/src/sources/channel.rs @@ -36,7 +36,7 @@ pub struct Sender { } impl Clone for Sender { - #[cfg_attr(feature = "nightly_coverage", no_coverage)] + #[cfg_attr(feature = "nightly_coverage", coverage(off))] fn clone(&self) -> Sender { Sender { sender: self.sender.clone(), @@ -72,7 +72,7 @@ pub struct SyncSender { } impl Clone for SyncSender { - #[cfg_attr(feature = "nightly_coverage", no_coverage)] + #[cfg_attr(feature = "nightly_coverage", coverage(off))] fn clone(&self) -> SyncSender { SyncSender { sender: self.sender.clone(), diff --git a/src/sources/mod.rs b/src/sources/mod.rs index f314442f..cfe0ef3d 100644 --- a/src/sources/mod.rs +++ b/src/sources/mod.rs @@ -478,7 +478,7 @@ where pub struct Dispatcher<'a, S, Data>(Rc + 'a>); impl<'a, S, Data> std::fmt::Debug for Dispatcher<'a, S, Data> { - #[cfg_attr(feature = "nightly_coverage", no_coverage)] + #[cfg_attr(feature = "nightly_coverage", coverage(off))] fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.write_str("Dispatcher { ... }") } @@ -555,7 +555,7 @@ pub struct Idle<'i> { } impl<'i> std::fmt::Debug for Idle<'i> { - #[cfg_attr(feature = "nightly_coverage", no_coverage)] + #[cfg_attr(feature = "nightly_coverage", coverage(off))] fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.write_str("Idle { ... }") } diff --git a/src/sources/timer.rs b/src/sources/timer.rs index fe15f64b..7a4cba85 100644 --- a/src/sources/timer.rs +++ b/src/sources/timer.rs @@ -280,7 +280,7 @@ impl std::cmp::PartialOrd for TimeoutData { // This impl is required for PartialOrd but actually never used // and the type is private, so ignore its coverage impl std::cmp::PartialEq for TimeoutData { - #[cfg_attr(feature = "nightly_coverage", no_coverage)] + #[cfg_attr(feature = "nightly_coverage", coverage(off))] fn eq(&self, other: &Self) -> bool { self.deadline == other.deadline } @@ -297,7 +297,7 @@ pub struct TimeoutFuture { } impl std::fmt::Debug for TimeoutFuture { - #[cfg_attr(feature = "nightly_coverage", no_coverage)] + #[cfg_attr(feature = "nightly_coverage", coverage(off))] fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("TimeoutFuture") .field("deadline", &self.deadline) diff --git a/src/sys.rs b/src/sys.rs index bc8350ca..35e39fb3 100644 --- a/src/sys.rs +++ b/src/sys.rs @@ -200,7 +200,7 @@ pub struct Poll { } impl std::fmt::Debug for Poll { - #[cfg_attr(feature = "nightly_coverage", no_coverage)] + #[cfg_attr(feature = "nightly_coverage", coverage(off))] fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.write_str("Poll { ... }") }