Skip to content

Commit

Permalink
Fix coverage testing on the CI
Browse files Browse the repository at this point in the history
The way coverage is enabled/disabled was changed upstream.

Links: rust-lang/rust#114656
  • Loading branch information
kchibisov authored and elinorbgr committed Sep 18, 2023
1 parent 1c2fd23 commit 2feb1cf
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub struct InsertError<T> {
}

impl<T> Debug for InsertError<T> {
#[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)
}
Expand All @@ -76,7 +76,7 @@ impl<T> Debug for InsertError<T> {
impl<T> From<InsertError<T>> 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<T>) -> crate::Error {
e.error
}
Expand Down
2 changes: 1 addition & 1 deletion src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
10 changes: 5 additions & 5 deletions src/loop_logic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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<S>(
&self,
dispatcher: Dispatcher<'l, S, Data>,
Expand Down Expand Up @@ -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 { ... }")
}
Expand Down Expand Up @@ -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 { ... }")
}
Expand Down
4 changes: 2 additions & 2 deletions src/sources/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub struct Sender<T> {
}

impl<T> Clone for Sender<T> {
#[cfg_attr(feature = "nightly_coverage", no_coverage)]
#[cfg_attr(feature = "nightly_coverage", coverage(off))]
fn clone(&self) -> Sender<T> {
Sender {
sender: self.sender.clone(),
Expand Down Expand Up @@ -72,7 +72,7 @@ pub struct SyncSender<T> {
}

impl<T> Clone for SyncSender<T> {
#[cfg_attr(feature = "nightly_coverage", no_coverage)]
#[cfg_attr(feature = "nightly_coverage", coverage(off))]
fn clone(&self) -> SyncSender<T> {
SyncSender {
sender: self.sender.clone(),
Expand Down
4 changes: 2 additions & 2 deletions src/sources/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ where
pub struct Dispatcher<'a, S, Data>(Rc<dyn ErasedDispatcher<'a, S, Data> + '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 { ... }")
}
Expand Down Expand Up @@ -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 { ... }")
}
Expand Down
4 changes: 2 additions & 2 deletions src/sources/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 { ... }")
}
Expand Down

0 comments on commit 2feb1cf

Please sign in to comment.