Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix coverage testing on the CI #150

Merged
merged 1 commit into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
}

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 Expand Up @@ -180,7 +180,7 @@
unsafe fn register(&self, dispatcher: &RefCell<IoDispatcher>) -> crate::Result<()> {
let disp = dispatcher.borrow();
self.poll.borrow_mut().register(
unsafe { BorrowedFd::borrow_raw(disp.fd) },

Check warning on line 183 in src/io.rs

View workflow job for this annotation

GitHub Actions / CI (1.63.0)

unnecessary `unsafe` block

Check warning on line 183 in src/io.rs

View workflow job for this annotation

GitHub Actions / CI (1.63.0)

unnecessary `unsafe` block
Interest::EMPTY,
Mode::OneShot,
disp.token.expect("No token for IO dispatcher"),
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
//!
//! - [MPSC channels](channel)
//! - [Timers](timer)
//! - [unix signals](signals) on Linux

Check warning on line 105 in src/lib.rs

View workflow job for this annotation

GitHub Actions / Documentation on Github Pages

unresolved link to `signals`
//!
//! As well as generic objects backed by file descriptors.
//!
Expand Down 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 @@
}

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 Expand Up @@ -330,7 +330,7 @@
let ev = cvt_interest(interest, token);

// SAFETY: See invariant on function.
unsafe {

Check warning on line 333 in src/sys.rs

View workflow job for this annotation

GitHub Actions / CI (1.63.0)

unnecessary `unsafe` block

Check warning on line 333 in src/sys.rs

View workflow job for this annotation

GitHub Actions / CI (1.63.0)

unnecessary `unsafe` block
self.poller
.add_with_mode(raw, ev, cvt_mode(mode, self.poller.supports_level()))?;
}
Expand Down
Loading