@@ -28,12 +28,9 @@ pub async fn voice_state_update(ctx: &Context, new: &VoiceState) {
2828 if let Some ( cid) = get_voice_channel_id ( guild_id) . await {
2929 // GuildRef forces a block here to prevent hold over await
3030 {
31- let guild = match guild_id. to_guild_cached ( & ctx. cache ) {
32- Some ( g) => g,
33- None => {
34- warn ! ( "guild id {} not found in cache" , guild_id) ;
35- return ;
36- }
31+ let Some ( guild) = guild_id. to_guild_cached ( & ctx. cache ) else {
32+ warn ! ( "guild id {} not found in cache" , guild_id) ;
33+ return ;
3734 } ;
3835
3936 // iterate through voice states in the guild
@@ -81,7 +78,7 @@ pub async fn voice_state_update(ctx: &Context, new: &VoiceState) {
8178 . map ( |x| x. map ( |y| y. auto_join ) )
8279 {
8380 Ok ( Some ( true ) ) => {
84- debug ! ( %guild_id, "guild has auto join enabled, proceeding with join" )
81+ debug ! ( %guild_id, "guild has auto join enabled, proceeding with join" ) ;
8582 }
8683 Ok ( Some ( false ) ) => {
8784 // auto join is not enabled, so we don't need to do anything
@@ -111,17 +108,14 @@ pub async fn voice_state_update(ctx: &Context, new: &VoiceState) {
111108 if target_user. bot ( ) {
112109 debug ! ( %guild_id, "user {} is a bot, not continuing with join" , target_user. id) ;
113110 return ;
114- } ;
111+ }
115112
116113 // now we need to check the voice channel the user is joining
117114 // discord doesn't give us the channel id, so we need to get it from the guild's voice states
118115 let vs = {
119- let guild = match guild_id. to_guild_cached ( & ctx. cache ) {
120- Some ( g) => g,
121- None => {
122- warn ! ( %guild_id, "guild not found in cache" ) ;
123- return ;
124- }
116+ let Some ( guild) = guild_id. to_guild_cached ( & ctx. cache ) else {
117+ warn ! ( %guild_id, "guild not found in cache" ) ;
118+ return ;
125119 } ;
126120
127121 // fetch the user's voice state
0 commit comments