From 60f55d9d3a7e1e61cfeb008fc70ec170b24c9b35 Mon Sep 17 00:00:00 2001 From: bitfl0wer Date: Wed, 24 Jan 2024 23:26:59 +0100 Subject: [PATCH] exclude trivial id() functions from coverage --- src/types/entities/voice_state.rs | 1 + src/types/events/auto_moderation.rs | 2 ++ src/types/events/channel.rs | 4 ++++ src/types/events/guild.rs | 6 ++++++ src/types/events/mod.rs | 1 + src/types/events/thread.rs | 1 + 6 files changed, 15 insertions(+) diff --git a/src/types/entities/voice_state.rs b/src/types/entities/voice_state.rs index 911cf96..035f8f9 100644 --- a/src/types/entities/voice_state.rs +++ b/src/types/entities/voice_state.rs @@ -47,6 +47,7 @@ pub struct VoiceState { } impl Updateable for VoiceState { + #[cfg(not(tarpaulin_include))] fn id(&self) -> Snowflake { if let Some(id) = self.id { id // ID exists: Only the case for Spacebar Server impls diff --git a/src/types/events/auto_moderation.rs b/src/types/events/auto_moderation.rs index 2a2eb6b..b667486 100644 --- a/src/types/events/auto_moderation.rs +++ b/src/types/events/auto_moderation.rs @@ -31,7 +31,9 @@ pub struct AutoModerationRuleUpdate { } #[cfg(feature = "client")] +#[cfg(not(tarpaulin_include))] impl UpdateMessage for AutoModerationRuleUpdate { + #[cfg(not(tarpaulin_include))] fn id(&self) -> Option { Some(self.rule.id) } diff --git a/src/types/events/channel.rs b/src/types/events/channel.rs index 5ca73ec..10e8561 100644 --- a/src/types/events/channel.rs +++ b/src/types/events/channel.rs @@ -39,6 +39,7 @@ impl WebSocketEvent for ChannelCreate {} #[cfg(feature = "client")] impl UpdateMessage for ChannelCreate { + #[cfg(not(tarpaulin_include))] fn id(&self) -> Option { self.channel.guild_id } @@ -73,6 +74,8 @@ impl UpdateMessage for ChannelUpdate { let mut write = object_to_update.write().unwrap(); *write = self.channel.clone(); } + + #[cfg(not(tarpaulin_include))] fn id(&self) -> Option { Some(self.channel.id) } @@ -111,6 +114,7 @@ pub struct ChannelDelete { #[cfg(feature = "client")] impl UpdateMessage for ChannelDelete { + #[cfg(not(tarpaulin_include))] fn id(&self) -> Option { self.channel.guild_id } diff --git a/src/types/events/guild.rs b/src/types/events/guild.rs index 04f871a..a460403 100644 --- a/src/types/events/guild.rs +++ b/src/types/events/guild.rs @@ -30,7 +30,9 @@ pub struct GuildCreate { } #[cfg(feature = "client")] +#[cfg(not(tarpaulin_include))] impl UpdateMessage for GuildCreate { + #[cfg(not(tarpaulin_include))] fn id(&self) -> Option { match &self.d { GuildCreateDataOption::UnavailableGuild(unavailable) => Some(unavailable.id), @@ -92,6 +94,7 @@ impl WebSocketEvent for GuildUpdate {} #[cfg(feature = "client")] impl UpdateMessage for GuildUpdate { + #[cfg(not(tarpaulin_include))] fn id(&self) -> Option { Some(self.guild.id) } @@ -111,6 +114,7 @@ pub struct GuildDelete { #[cfg(feature = "client")] impl UpdateMessage for GuildDelete { + #[cfg(not(tarpaulin_include))] fn id(&self) -> Option { Some(self.guild.id) } @@ -225,6 +229,7 @@ impl WebSocketEvent for GuildRoleCreate {} #[cfg(feature = "client")] impl UpdateMessage for GuildRoleCreate { + #[cfg(not(tarpaulin_include))] fn id(&self) -> Option { Some(self.guild_id) } @@ -258,6 +263,7 @@ impl WebSocketEvent for GuildRoleUpdate {} #[cfg(feature = "client")] impl UpdateMessage for GuildRoleUpdate { + #[cfg(not(tarpaulin_include))] fn id(&self) -> Option { Some(self.role.id) } diff --git a/src/types/events/mod.rs b/src/types/events/mod.rs index 5644d8a..5c8e6c4 100644 --- a/src/types/events/mod.rs +++ b/src/types/events/mod.rs @@ -135,6 +135,7 @@ where fn update(&mut self, object_to_update: Shared) { update_object(self.get_json(), object_to_update) } + #[cfg(not(tarpaulin_include))] fn id(&self) -> Option; } diff --git a/src/types/events/thread.rs b/src/types/events/thread.rs index cff5f6f..34dd1a2 100644 --- a/src/types/events/thread.rs +++ b/src/types/events/thread.rs @@ -32,6 +32,7 @@ impl WebSocketEvent for ThreadUpdate {} #[cfg(feature = "client")] impl UpdateMessage for ThreadUpdate { + #[cfg(not(tarpaulin_include))] fn id(&self) -> Option { Some(self.thread.id) }