diff --git a/src/collector/mod.rs b/src/collector/mod.rs index b004106dbd5..3015ac5ce13 100644 --- a/src/collector/mod.rs +++ b/src/collector/mod.rs @@ -178,7 +178,7 @@ make_specific_collector!( // - filter expression (this expressoin must return true to let the event through) author_id: UserId => interaction.user.id == *author_id, channel_id: ChannelId => interaction.channel_id == *channel_id, - guild_id: GuildId => interaction.guild_id.map_or(true, |x| x == *guild_id), + guild_id: GuildId => interaction.guild_id.is_none_or(|x| x == *guild_id), message_id: MessageId => interaction.message.id == *message_id, custom_ids: FixedArray => custom_ids.contains(&interaction.data.custom_id), ); @@ -190,17 +190,17 @@ make_specific_collector!( }) => interaction, author_id: UserId => interaction.user.id == *author_id, channel_id: ChannelId => interaction.channel_id == *channel_id, - guild_id: GuildId => interaction.guild_id.map_or(true, |g| g == *guild_id), - message_id: MessageId => interaction.message.as_ref().map_or(true, |m| m.id == *message_id), + guild_id: GuildId => interaction.guild_id.is_none_or(|g| g == *guild_id), + message_id: MessageId => interaction.message.as_ref().is_none_or(|m| m.id == *message_id), custom_ids: Vec => custom_ids.contains(&interaction.data.custom_id), ); make_specific_collector!( ReactionCollector, Reaction, CollectReactions, collect_reactions, Event::ReactionAdd(ReactionAddEvent { reaction }) => reaction, - author_id: UserId => reaction.user_id.map_or(true, |a| a == *author_id), + author_id: UserId => reaction.user_id.is_none_or(|a| a == *author_id), channel_id: ChannelId => reaction.channel_id == *channel_id, - guild_id: GuildId => reaction.guild_id.map_or(true, |g| g == *guild_id), + guild_id: GuildId => reaction.guild_id.is_none_or(|g| g == *guild_id), message_id: MessageId => reaction.message_id == *message_id, ); make_specific_collector!( @@ -209,5 +209,5 @@ make_specific_collector!( Event::MessageCreate(MessageCreateEvent { message }) => message, author_id: UserId => message.author.id == *author_id, channel_id: ChannelId => message.channel_id == *channel_id, - guild_id: GuildId => message.guild_id.map_or(true, |g| g == *guild_id), + guild_id: GuildId => message.guild_id.is_none_or(|g| g == *guild_id), ); diff --git a/src/gateway/sharding/mod.rs b/src/gateway/sharding/mod.rs index e189c0674c8..80451a274bf 100644 --- a/src/gateway/sharding/mod.rs +++ b/src/gateway/sharding/mod.rs @@ -459,7 +459,7 @@ impl Shard { } let resume = num - .map_or(true, |x| x != close_codes::AUTHENTICATION_FAILED && self.session_id.is_some()); + .is_none_or(|x| x != close_codes::AUTHENTICATION_FAILED && self.session_id.is_some()); Ok(Some(if resume { ShardAction::Reconnect(ReconnectType::Resume) diff --git a/src/gateway/sharding/shard_runner.rs b/src/gateway/sharding/shard_runner.rs index 00b6f91763b..f5b3a8c28ac 100644 --- a/src/gateway/sharding/shard_runner.rs +++ b/src/gateway/sharding/shard_runner.rs @@ -178,11 +178,11 @@ impl ShardRunner { let can_dispatch = self .event_handler .as_ref() - .map_or(true, |handler| handler.filter_event(&context, &event)) + .is_none_or(|handler| handler.filter_event(&context, &event)) && self .raw_event_handler .as_ref() - .map_or(true, |handler| handler.filter_event(&context, &event)); + .is_none_or(|handler| handler.filter_event(&context, &event)); if can_dispatch { #[cfg(feature = "collector")] diff --git a/src/model/guild/mod.rs b/src/model/guild/mod.rs index 4ae68ef6bf1..eb2c1b8e83a 100644 --- a/src/model/guild/mod.rs +++ b/src/model/guild/mod.rs @@ -595,7 +595,7 @@ impl Guild { for member in &self.members { if &*member.user.name == username - && discrim.map_or(true, |d| member.user.discriminator == d) + && discrim.is_none_or(|d| member.user.discriminator == d) { return Some(member); }