Skip to content

Commit

Permalink
exclude trivial id() functions from coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
bitfl0wer committed Jan 24, 2024
1 parent 153bfc2 commit 60f55d9
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/types/entities/voice_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/types/events/auto_moderation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ pub struct AutoModerationRuleUpdate {
}

#[cfg(feature = "client")]
#[cfg(not(tarpaulin_include))]
impl UpdateMessage<AutoModerationRule> for AutoModerationRuleUpdate {
#[cfg(not(tarpaulin_include))]
fn id(&self) -> Option<Snowflake> {
Some(self.rule.id)
}
Expand Down
4 changes: 4 additions & 0 deletions src/types/events/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ impl WebSocketEvent for ChannelCreate {}

#[cfg(feature = "client")]
impl UpdateMessage<Guild> for ChannelCreate {
#[cfg(not(tarpaulin_include))]
fn id(&self) -> Option<Snowflake> {
self.channel.guild_id
}
Expand Down Expand Up @@ -73,6 +74,8 @@ impl UpdateMessage<Channel> for ChannelUpdate {
let mut write = object_to_update.write().unwrap();
*write = self.channel.clone();
}

#[cfg(not(tarpaulin_include))]
fn id(&self) -> Option<Snowflake> {
Some(self.channel.id)
}
Expand Down Expand Up @@ -111,6 +114,7 @@ pub struct ChannelDelete {

#[cfg(feature = "client")]
impl UpdateMessage<Guild> for ChannelDelete {
#[cfg(not(tarpaulin_include))]
fn id(&self) -> Option<Snowflake> {
self.channel.guild_id
}
Expand Down
6 changes: 6 additions & 0 deletions src/types/events/guild.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ pub struct GuildCreate {
}

#[cfg(feature = "client")]
#[cfg(not(tarpaulin_include))]
impl UpdateMessage<Guild> for GuildCreate {
#[cfg(not(tarpaulin_include))]
fn id(&self) -> Option<Snowflake> {
match &self.d {
GuildCreateDataOption::UnavailableGuild(unavailable) => Some(unavailable.id),
Expand Down Expand Up @@ -92,6 +94,7 @@ impl WebSocketEvent for GuildUpdate {}

#[cfg(feature = "client")]
impl UpdateMessage<Guild> for GuildUpdate {
#[cfg(not(tarpaulin_include))]
fn id(&self) -> Option<Snowflake> {
Some(self.guild.id)
}
Expand All @@ -111,6 +114,7 @@ pub struct GuildDelete {

#[cfg(feature = "client")]
impl UpdateMessage<Guild> for GuildDelete {
#[cfg(not(tarpaulin_include))]
fn id(&self) -> Option<Snowflake> {
Some(self.guild.id)
}
Expand Down Expand Up @@ -225,6 +229,7 @@ impl WebSocketEvent for GuildRoleCreate {}

#[cfg(feature = "client")]
impl UpdateMessage<Guild> for GuildRoleCreate {
#[cfg(not(tarpaulin_include))]
fn id(&self) -> Option<Snowflake> {
Some(self.guild_id)
}
Expand Down Expand Up @@ -258,6 +263,7 @@ impl WebSocketEvent for GuildRoleUpdate {}

#[cfg(feature = "client")]
impl UpdateMessage<RoleObject> for GuildRoleUpdate {
#[cfg(not(tarpaulin_include))]
fn id(&self) -> Option<Snowflake> {
Some(self.role.id)
}
Expand Down
1 change: 1 addition & 0 deletions src/types/events/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ where
fn update(&mut self, object_to_update: Shared<T>) {
update_object(self.get_json(), object_to_update)
}
#[cfg(not(tarpaulin_include))]
fn id(&self) -> Option<Snowflake>;
}

Expand Down
1 change: 1 addition & 0 deletions src/types/events/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ impl WebSocketEvent for ThreadUpdate {}

#[cfg(feature = "client")]
impl UpdateMessage<Channel> for ThreadUpdate {
#[cfg(not(tarpaulin_include))]
fn id(&self) -> Option<Snowflake> {
Some(self.thread.id)
}
Expand Down

0 comments on commit 60f55d9

Please sign in to comment.