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

CI: fix coverage attribute #657

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
18 changes: 9 additions & 9 deletions wayland-backend/src/client_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub trait ObjectData: downcast_rs::DowncastSync {
/// Helper for forwarding a Debug implementation of your `ObjectData` type
///
/// By default will just print `ObjectData { ... }`
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn debug(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("ObjectData").finish_non_exhaustive()
}
Expand All @@ -52,7 +52,7 @@ pub trait ObjectData: downcast_rs::DowncastSync {
}

impl std::fmt::Debug for dyn ObjectData {
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
self.debug(f)
}
Expand All @@ -72,15 +72,15 @@ pub struct ObjectId {
}

impl fmt::Display for ObjectId {
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
#[inline]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.id.fmt(f)
}
}

impl fmt::Debug for ObjectId {
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
#[inline]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.id.fmt(f)
Expand Down Expand Up @@ -322,7 +322,7 @@ impl ReadEventsGuard {
pub(crate) struct DumbObjectData;

impl ObjectData for DumbObjectData {
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn event(
self: Arc<Self>,
_handle: &Backend,
Expand All @@ -331,7 +331,7 @@ impl ObjectData for DumbObjectData {
unreachable!()
}

#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn destroyed(&self, _object_id: ObjectId) {
unreachable!()
}
Expand All @@ -340,7 +340,7 @@ impl ObjectData for DumbObjectData {
pub(crate) struct UninitObjectData;

impl ObjectData for UninitObjectData {
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn event(
self: Arc<Self>,
_handle: &Backend,
Expand All @@ -349,10 +349,10 @@ impl ObjectData for UninitObjectData {
panic!("Received a message on an uninitialized object: {:?}", msg);
}

#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn destroyed(&self, _object_id: ObjectId) {}

#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn debug(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("UninitObjectData").finish()
}
Expand Down
2 changes: 1 addition & 1 deletion wayland-backend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#![warn(missing_docs, missing_debug_implementations)]
// The api modules are imported two times each, this is not accidental
#![allow(clippy::duplicate_mod)]
#![cfg_attr(coverage, feature(no_coverage))]
#![cfg_attr(coverage, feature(coverage_attribute))]
// Doc feature labels can be tested locally by running RUSTDOCFLAGS="--cfg=docsrs" cargo +nightly doc -p <crate>
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

Expand Down
6 changes: 3 additions & 3 deletions wayland-backend/src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ impl<Id: PartialEq, Fd: AsRawFd> PartialEq for Argument<Id, Fd> {
impl<Id: Eq, Fd: AsRawFd> Eq for Argument<Id, Fd> {}

impl<Id: std::fmt::Display, Fd: AsRawFd> std::fmt::Display for Argument<Id, Fd> {
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Int(value) => write!(f, "{}", value),
Expand Down Expand Up @@ -151,7 +151,7 @@ pub struct Interface {
}

impl std::fmt::Display for Interface {
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.name)
}
Expand Down Expand Up @@ -250,7 +250,7 @@ impl<Id: Eq, Fd: AsRawFd> Eq for Message<Id, Fd> {}
impl std::error::Error for ProtocolError {}

impl std::fmt::Display for ProtocolError {
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error> {
write!(
f,
Expand Down
4 changes: 2 additions & 2 deletions wayland-backend/src/rs/client_impl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ impl std::hash::Hash for InnerObjectId {
}

impl fmt::Display for InnerObjectId {
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}@{}", self.interface.name, self.id)
}
}

impl fmt::Debug for InnerObjectId {
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "ObjectId({}, {})", self, self.serial)
}
Expand Down
8 changes: 4 additions & 4 deletions wayland-backend/src/rs/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::protocol::Argument;
/// Print the dispatched message to stderr in a following format:
///
/// [timestamp] <- [email protected]_name(args)
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
pub fn print_dispatched_message<Id: Display, Fd: AsRawFd>(
interface: &str,
id: u32,
Expand All @@ -30,7 +30,7 @@ pub fn print_dispatched_message<Id: Display, Fd: AsRawFd>(
/// Print the send message to stderr in a following format:
///
/// [timestamp] -> [email protected]_name(args)
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
pub fn print_send_message<Id: Display, Fd: AsRawFd>(
interface: &str,
id: u32,
Expand All @@ -49,7 +49,7 @@ pub fn print_send_message<Id: Display, Fd: AsRawFd>(
pub(crate) struct DisplaySlice<'a, D>(pub &'a [D]);

impl<'a, D: Display> Display for DisplaySlice<'a, D> {
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut it = self.0.iter();
if let Some(val) = it.next() {
Expand All @@ -63,7 +63,7 @@ impl<'a, D: Display> Display for DisplaySlice<'a, D> {
}

/// Print timestamp in seconds.microseconds format.
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn print_timestamp() {
if let Ok(timestamp) = SystemTime::now().duration_since(UNIX_EPOCH) {
let sc = timestamp.as_secs();
Expand Down
12 changes: 6 additions & 6 deletions wayland-backend/src/rs/server_impl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ impl InnerObjectId {
}

impl fmt::Display for InnerObjectId {
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}@{}[{}]", self.interface.name, self.id, self.client_id.id)
}
}

impl fmt::Debug for InnerObjectId {
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "ObjectId({}, {})", self, self.serial)
}
Expand Down Expand Up @@ -106,7 +106,7 @@ pub(crate) struct Data<D: 'static> {
}

impl<D> Clone for Data<D> {
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn clone(&self) -> Self {
Self { user_data: self.user_data.clone(), serial: self.serial }
}
Expand All @@ -115,7 +115,7 @@ impl<D> Clone for Data<D> {
struct UninitObjectData;

impl<D> ObjectData<D> for UninitObjectData {
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn request(
self: Arc<Self>,
_: &Handle,
Expand All @@ -126,10 +126,10 @@ impl<D> ObjectData<D> for UninitObjectData {
panic!("Received a message on an uninitialized object: {:?}", msg);
}

#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn destroyed(self: Arc<Self>, _: &Handle, _: &mut D, _: ClientId, _: ObjectId) {}

#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn debug(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("UninitObjectData").finish()
}
Expand Down
4 changes: 2 additions & 2 deletions wayland-backend/src/rs/wire.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub enum MessageWriteError {
impl std::error::Error for MessageWriteError {}

impl std::fmt::Display for MessageWriteError {
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error> {
match self {
Self::BufferTooSmall => {
Expand Down Expand Up @@ -52,7 +52,7 @@ pub enum MessageParseError {
impl std::error::Error for MessageParseError {}

impl std::fmt::Display for MessageParseError {
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error> {
match *self {
Self::MissingFD => {
Expand Down
24 changes: 12 additions & 12 deletions wayland-backend/src/server_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub trait ObjectData<D>: downcast_rs::DowncastSync {
/// Helper for forwarding a Debug implementation of your `ObjectData` type
///
/// By default will just print `ObjectData { ... }`
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn debug(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("ObjectData").finish_non_exhaustive()
}
Expand All @@ -50,7 +50,7 @@ pub trait ObjectData<D>: downcast_rs::DowncastSync {
downcast_rs::impl_downcast!(sync ObjectData<D>);

impl<D: 'static> std::fmt::Debug for dyn ObjectData<D> {
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
self.debug(f)
}
Expand Down Expand Up @@ -89,14 +89,14 @@ pub trait GlobalHandler<D>: downcast_rs::DowncastSync {
/// Helper for forwarding a Debug implementation of your `GlobalHandler` type
///
/// By default will just print `GlobalHandler { ... }`
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn debug(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("GlobalHandler").finish_non_exhaustive()
}
}

impl<D: 'static> std::fmt::Debug for dyn GlobalHandler<D> {
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.debug(f)
}
Expand All @@ -113,14 +113,14 @@ pub trait ClientData: downcast_rs::DowncastSync {
/// Helper for forwarding a Debug implementation of your `ClientData` type
///
/// By default will just print `GlobalHandler { ... }`
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn debug(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("ClientData").finish_non_exhaustive()
}
}

impl std::fmt::Debug for dyn ClientData {
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.debug(f)
}
Expand Down Expand Up @@ -183,14 +183,14 @@ impl ObjectId {
}

impl fmt::Display for ObjectId {
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.id.fmt(f)
}
}

impl fmt::Debug for ObjectId {
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.id.fmt(f)
}
Expand All @@ -207,7 +207,7 @@ pub struct ClientId {
}

impl fmt::Debug for ClientId {
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.id.fmt(f)
}
Expand All @@ -220,7 +220,7 @@ pub struct GlobalId {
}

impl fmt::Debug for GlobalId {
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.id.fmt(f)
}
Expand Down Expand Up @@ -579,7 +579,7 @@ impl<D> Backend<D> {
pub(crate) struct DumbObjectData;

impl<D> ObjectData<D> for DumbObjectData {
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn request(
self: Arc<Self>,
_handle: &Handle,
Expand All @@ -590,7 +590,7 @@ impl<D> ObjectData<D> for DumbObjectData {
unreachable!()
}

#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn destroyed(
self: Arc<Self>,
_handle: &Handle,
Expand Down
4 changes: 2 additions & 2 deletions wayland-backend/src/sys/client_impl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@ impl InnerObjectId {
}

impl std::fmt::Display for InnerObjectId {
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}@{}", self.interface.name, self.id)
}
}

impl std::fmt::Debug for InnerObjectId {
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "ObjectId({})", self)
}
Expand Down
10 changes: 5 additions & 5 deletions wayland-backend/src/sys/server_impl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ impl std::hash::Hash for InnerObjectId {
}

impl std::fmt::Display for InnerObjectId {
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}@{}", self.interface.name, self.id)
}
}

impl std::fmt::Debug for InnerObjectId {
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "ObjectId({})", self)
}
Expand Down Expand Up @@ -1633,7 +1633,7 @@ extern "C" {
struct UninitObjectData;

impl<D> ObjectData<D> for UninitObjectData {
#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn request(
self: Arc<Self>,
_: &Handle,
Expand All @@ -1644,10 +1644,10 @@ impl<D> ObjectData<D> for UninitObjectData {
panic!("Received a message on an uninitialized object: {:?}", msg);
}

#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn destroyed(self: Arc<Self>, _: &Handle, _: &mut D, _: ClientId, _: ObjectId) {}

#[cfg_attr(coverage, no_coverage)]
#[cfg_attr(coverage, coverage(off))]
fn debug(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("UninitObjectData").finish()
}
Expand Down
Loading