From 6586830e9737a6fea256c8b48e83760898e33285 Mon Sep 17 00:00:00 2001 From: Ken Swenson Date: Mon, 3 Jun 2019 10:33:02 -0400 Subject: [PATCH] Implement suggestions from clippy & remove clippy arg max config (#595) --- clippy.toml | 1 - src/framework/standard/help_commands.rs | 24 ++++++++++++------------ src/model/channel/guild_channel.rs | 3 +-- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/clippy.toml b/clippy.toml index 134a3f436e0..b695120740d 100644 --- a/clippy.toml +++ b/clippy.toml @@ -5,4 +5,3 @@ doc-valid-idents = [ ] enum-variant-name-threshold = 1 single-char-binding-names-threshold = 3 -too-many-arguments-threshold = 6 diff --git a/src/framework/standard/help_commands.rs b/src/framework/standard/help_commands.rs index ae0019260e7..95d422a37be 100644 --- a/src/framework/standard/help_commands.rs +++ b/src/framework/standard/help_commands.rs @@ -736,20 +736,20 @@ pub fn searched_lowercase<'a>( ) }; let mut progressed = is_prefixless_group; + let is_word_prefix = group + .options + .prefixes + .iter() + .any(|prefix| { + if starts_with_whole_word(&searched_named_lowercase, &prefix) { + searched_named_lowercase.drain(..=prefix.len()); + progressed = true; + } - if is_prefixless_group - || group - .options - .prefixes - .iter() - .any(|prefix| { - if starts_with_whole_word(&searched_named_lowercase, &prefix) { - searched_named_lowercase.drain(..=prefix.len()); - progressed = true; - } + prefix == searched_named_lowercase + }); - prefix == &searched_named_lowercase - }) + if is_prefixless_group || is_word_prefix { let single_group = create_single_group(&context, &group, owners, &msg, &help_options); diff --git a/src/model/channel/guild_channel.rs b/src/model/channel/guild_channel.rs index 370160f2f6f..8ee1abce551 100644 --- a/src/model/channel/guild_channel.rs +++ b/src/model/channel/guild_channel.rs @@ -730,8 +730,7 @@ impl GuildChannel { .voice_states .values() .filter_map(|v| { - v.channel_id.map_or( - None, + v.channel_id.and_then( |c| { if c == self.id { guild.read().members.get(&v.user_id).cloned()