diff --git a/src/http/client.rs b/src/http/client.rs index baa6e04568a..a8c446ef5a6 100644 --- a/src/http/client.rs +++ b/src/http/client.rs @@ -253,7 +253,7 @@ impl Http { guild_id, user_id, }, - params: [].into(), + params: &[], }) .await?; @@ -286,7 +286,7 @@ impl Http { role_id, user_id, }, - params: [].into(), + params: &[], }) .await } @@ -318,7 +318,7 @@ impl Http { guild_id, user_id, }, - params: [("delete_message_seconds", delete_message_seconds.to_string())].into(), + params: &[("delete_message_seconds", delete_message_seconds.to_string())], }) .await } @@ -340,7 +340,7 @@ impl Http { route: Route::GuildBulkBan { guild_id, }, - params: [].into(), + params: &[], }) .await } @@ -361,7 +361,7 @@ impl Http { route: Route::ChannelTyping { channel_id, }, - params: [].into(), + params: &[], }) .await } @@ -390,7 +390,7 @@ impl Http { route: Route::GuildChannels { guild_id, }, - params: [].into(), + params: &[], }) .await } @@ -407,7 +407,7 @@ impl Http { headers: audit_log_reason.map(reason_into_header), method: LightMethod::Post, route: Route::StageInstances, - params: [].into(), + params: &[], }) .await } @@ -431,7 +431,7 @@ impl Http { channel_id, message_id, }, - params: [].into(), + params: &[], }) .await } @@ -453,7 +453,7 @@ impl Http { route: Route::ChannelThreads { channel_id, }, - params: [].into(), + params: &[], }) .await } @@ -488,7 +488,7 @@ impl Http { route: Route::ChannelForumPosts { channel_id, }, - params: [].into(), + params: &[], }) .await } @@ -514,7 +514,7 @@ impl Http { route: Route::GuildEmojis { guild_id, }, - params: [].into(), + params: &[], }) .await } @@ -537,7 +537,7 @@ impl Http { application_id: self.try_application_id()?, token: interaction_token, }, - params: [].into(), + params: &[], }; if files.is_empty() { @@ -572,7 +572,7 @@ impl Http { route: Route::Commands { application_id: self.try_application_id()?, }, - params: [].into(), + params: &[], }) .await } @@ -590,7 +590,7 @@ impl Http { route: Route::Commands { application_id: self.try_application_id()?, }, - params: [].into(), + params: &[], }) .await } @@ -610,7 +610,7 @@ impl Http { application_id: self.try_application_id()?, guild_id, }, - params: [].into(), + params: &[], }) .await } @@ -655,7 +655,7 @@ impl Http { headers: None, method: LightMethod::Post, route: Route::Guilds, - params: [].into(), + params: &[], }) .await } @@ -681,7 +681,7 @@ impl Http { application_id: self.try_application_id()?, guild_id, }, - params: [].into(), + params: &[], }) .await } @@ -710,7 +710,7 @@ impl Http { guild_id, integration_id, }, - params: [].into(), + params: &[], }) .await } @@ -737,7 +737,7 @@ impl Http { interaction_id, token: interaction_token, }, - params: [].into(), + params: &[], }; if files.is_empty() { @@ -779,7 +779,7 @@ impl Http { route: Route::ChannelInvites { channel_id, }, - params: [].into(), + params: &[], }) .await } @@ -803,7 +803,7 @@ impl Http { channel_id, target_id, }, - params: [].into(), + params: &[], }) .await } @@ -818,7 +818,7 @@ impl Http { headers: None, method: LightMethod::Post, route: Route::UserMeDmChannels, - params: [].into(), + params: &[], }) .await } @@ -840,7 +840,7 @@ impl Http { message_id, reaction: &reaction_type.as_data(), }, - params: [].into(), + params: &[], }) .await } @@ -861,7 +861,7 @@ impl Http { route: Route::GuildRoles { guild_id, }, - params: [].into(), + params: &[], }) .await?; @@ -894,7 +894,7 @@ impl Http { route: Route::GuildScheduledEvents { guild_id, }, - params: [].into(), + params: &[], }) .await } @@ -923,7 +923,7 @@ impl Http { route: Route::GuildStickers { guild_id, }, - params: [].into(), + params: &[], }) .await } @@ -953,7 +953,7 @@ impl Http { route: Route::Entitlements { application_id: self.try_application_id()?, }, - params: [].into(), + params: &[], }) .await } @@ -1000,7 +1000,7 @@ impl Http { route: Route::ChannelWebhooks { channel_id, }, - params: [].into(), + params: &[], }) .await } @@ -1019,7 +1019,7 @@ impl Http { route: Route::Channel { channel_id, }, - params: [].into(), + params: &[], }) .await } @@ -1038,7 +1038,7 @@ impl Http { route: Route::StageInstance { channel_id, }, - params: [].into(), + params: &[], }) .await } @@ -1061,7 +1061,7 @@ impl Http { guild_id, emoji_id, }, - params: [].into(), + params: &[], }) .await } @@ -1082,7 +1082,7 @@ impl Http { token: interaction_token, message_id, }, - params: [].into(), + params: &[], }) .await } @@ -1098,7 +1098,7 @@ impl Http { application_id: self.try_application_id()?, command_id, }, - params: [].into(), + params: &[], }) .await } @@ -1113,7 +1113,7 @@ impl Http { route: Route::Guild { guild_id, }, - params: [].into(), + params: &[], }) .await } @@ -1134,7 +1134,7 @@ impl Http { guild_id, command_id, }, - params: [].into(), + params: &[], }) .await } @@ -1155,7 +1155,7 @@ impl Http { guild_id, integration_id, }, - params: [].into(), + params: &[], }) .await } @@ -1174,7 +1174,7 @@ impl Http { route: Route::Invite { code, }, - params: [].into(), + params: &[], }) .await } @@ -1195,7 +1195,7 @@ impl Http { channel_id, message_id, }, - params: [].into(), + params: &[], }) .await } @@ -1215,7 +1215,7 @@ impl Http { route: Route::ChannelMessagesBulkDelete { channel_id, }, - params: [].into(), + params: &[], }) .await } @@ -1252,7 +1252,7 @@ impl Http { channel_id, message_id, }, - params: [].into(), + params: &[], }) .await } @@ -1274,7 +1274,7 @@ impl Http { message_id, reaction: &reaction_type.as_data(), }, - params: [].into(), + params: &[], }) .await } @@ -1293,7 +1293,7 @@ impl Http { application_id: self.try_application_id()?, token: interaction_token, }, - params: [].into(), + params: &[], }) .await } @@ -1314,7 +1314,7 @@ impl Http { channel_id, target_id, }, - params: [].into(), + params: &[], }) .await } @@ -1338,7 +1338,7 @@ impl Http { user_id, reaction: &reaction_type.as_data(), }, - params: [].into(), + params: &[], }) .await } @@ -1360,7 +1360,7 @@ impl Http { message_id, reaction: &reaction_type.as_data(), }, - params: [].into(), + params: &[], }) .await } @@ -1381,7 +1381,7 @@ impl Http { guild_id, role_id, }, - params: [].into(), + params: &[], }) .await } @@ -1406,7 +1406,7 @@ impl Http { guild_id, event_id, }, - params: [].into(), + params: &[], }) .await } @@ -1429,7 +1429,7 @@ impl Http { guild_id, sticker_id, }, - params: [].into(), + params: &[], }) .await } @@ -1446,7 +1446,7 @@ impl Http { application_id: self.try_application_id()?, entitlement_id, }, - params: [].into(), + params: &[], }) .await } @@ -1483,7 +1483,7 @@ impl Http { route: Route::Webhook { webhook_id, }, - params: [].into(), + params: &[], }) .await } @@ -1524,7 +1524,7 @@ impl Http { webhook_id, token, }, - params: [].into(), + params: &[], }) .await } @@ -1546,7 +1546,7 @@ impl Http { route: Route::Channel { channel_id, }, - params: [].into(), + params: &[], }) .await } @@ -1566,7 +1566,7 @@ impl Http { route: Route::StageInstance { channel_id, }, - params: [].into(), + params: &[], }) .await } @@ -1592,7 +1592,7 @@ impl Http { guild_id, emoji_id, }, - params: [].into(), + params: &[], }) .await } @@ -1619,7 +1619,7 @@ impl Http { token: interaction_token, message_id, }, - params: [].into(), + params: &[], }; if new_attachments.is_empty() { @@ -1655,7 +1655,7 @@ impl Http { token: interaction_token, message_id, }, - params: [].into(), + params: &[], }) .await } @@ -1681,7 +1681,7 @@ impl Http { application_id: self.try_application_id()?, command_id, }, - params: [].into(), + params: &[], }) .await } @@ -1703,7 +1703,7 @@ impl Http { route: Route::Guild { guild_id, }, - params: [].into(), + params: &[], }) .await } @@ -1731,7 +1731,7 @@ impl Http { guild_id, command_id, }, - params: [].into(), + params: &[], }) .await } @@ -1759,7 +1759,7 @@ impl Http { guild_id, command_id, }, - params: [].into(), + params: &[], }) .await } @@ -1780,7 +1780,7 @@ impl Http { route: Route::GuildChannels { guild_id, }, - params: [].into(), + params: &[], }) .await } @@ -1807,7 +1807,7 @@ impl Http { route: Route::GuildMfa { guild_id, }, - params: [].into(), + params: &[], }) .await .map(|mfa: GuildMfaLevel| mfa.level) @@ -1830,7 +1830,7 @@ impl Http { route: Route::GuildWidget { guild_id, }, - params: [].into(), + params: &[], }) .await } @@ -1852,7 +1852,7 @@ impl Http { route: Route::GuildWelcomeScreen { guild_id, }, - params: [].into(), + params: &[], }) .await } @@ -1877,7 +1877,7 @@ impl Http { guild_id, user_id, }, - params: [].into(), + params: &[], }) .await?; @@ -1907,7 +1907,7 @@ impl Http { channel_id, message_id, }, - params: [].into(), + params: &[], }; if new_attachments.is_empty() { @@ -1940,7 +1940,7 @@ impl Http { channel_id, message_id, }, - params: [].into(), + params: &[], }) .await } @@ -1962,7 +1962,7 @@ impl Http { route: Route::GuildMemberMe { guild_id, }, - params: [].into(), + params: &[], }) .await } @@ -1987,7 +1987,7 @@ impl Http { route: Route::GuildMemberMe { guild_id, }, - params: [].into(), + params: &[], }) .await } @@ -2009,7 +2009,7 @@ impl Http { route: Route::ChannelFollowNews { channel_id: news_channel_id, }, - params: [].into(), + params: &[], }) .await } @@ -2028,7 +2028,7 @@ impl Http { application_id: self.try_application_id()?, token: interaction_token, }, - params: [].into(), + params: &[], }) .await } @@ -2053,7 +2053,7 @@ impl Http { application_id: self.try_application_id()?, token: interaction_token, }, - params: [].into(), + params: &[], }; if new_attachments.is_empty() { @@ -2079,7 +2079,7 @@ impl Http { headers: None, method: LightMethod::Patch, route: Route::UserMe, - params: [].into(), + params: &[], }) .await } @@ -2102,7 +2102,7 @@ impl Http { guild_id, role_id, }, - params: [].into(), + params: &[], }) .await?; @@ -2136,7 +2136,7 @@ impl Http { route: Route::GuildRoles { guild_id, }, - params: [].into(), + params: &[], }) .await?; @@ -2173,7 +2173,7 @@ impl Http { guild_id, event_id, }, - params: [].into(), + params: &[], }) .await } @@ -2200,7 +2200,7 @@ impl Http { guild_id, sticker_id, }, - params: [].into(), + params: &[], }) .await?; @@ -2226,7 +2226,7 @@ impl Http { route: Route::Channel { channel_id, }, - params: [].into(), + params: &[], }) .await } @@ -2276,7 +2276,7 @@ impl Http { guild_id, user_id, }, - params: [].into(), + params: &[], }) .await } @@ -2327,7 +2327,7 @@ impl Http { route: Route::GuildVoiceStateMe { guild_id, }, - params: [].into(), + params: &[], }) .await } @@ -2378,7 +2378,7 @@ impl Http { route: Route::Webhook { webhook_id, }, - params: [].into(), + params: &[], }) .await } @@ -2426,7 +2426,7 @@ impl Http { webhook_id, token, }, - params: [].into(), + params: &[], }) .await } @@ -2506,7 +2506,7 @@ impl Http { webhook_id, token, }, - params, + params: ¶ms, }; if files.is_empty() { @@ -2551,7 +2551,7 @@ impl Http { token, message_id, }, - params, + params: ¶ms, }) .await } @@ -2581,7 +2581,7 @@ impl Http { token, message_id, }, - params, + params: ¶ms, }; if new_attachments.is_empty() { @@ -2620,7 +2620,7 @@ impl Http { token, message_id, }, - params, + params: ¶ms, }) .await } @@ -2642,7 +2642,7 @@ impl Http { headers: None, method: LightMethod::Get, route: Route::StatusMaintenancesActive, - params: [].into(), + params: &[], }) .await?; @@ -2686,7 +2686,7 @@ impl Http { route: Route::GuildBans { guild_id, }, - params, + params: ¶ms, }) .await } @@ -2722,7 +2722,7 @@ impl Http { route: Route::GuildAuditLogs { guild_id, }, - params, + params: ¶ms, }) .await } @@ -2739,7 +2739,7 @@ impl Http { route: Route::GuildAutomodRules { guild_id, }, - params: [].into(), + params: &[], }) .await } @@ -2757,7 +2757,7 @@ impl Http { guild_id, rule_id, }, - params: [].into(), + params: &[], }) .await } @@ -2781,7 +2781,7 @@ impl Http { route: Route::GuildAutomodRules { guild_id, }, - params: [].into(), + params: &[], }) .await } @@ -2807,7 +2807,7 @@ impl Http { guild_id, rule_id, }, - params: [].into(), + params: &[], }) .await } @@ -2830,7 +2830,7 @@ impl Http { guild_id, rule_id, }, - params: [].into(), + params: &[], }) .await } @@ -2843,7 +2843,7 @@ impl Http { headers: None, method: LightMethod::Get, route: Route::GatewayBot, - params: [].into(), + params: &[], }) .await } @@ -2858,7 +2858,7 @@ impl Http { route: Route::ChannelInvites { channel_id, }, - params: [].into(), + params: &[], }) .await } @@ -2876,7 +2876,7 @@ impl Http { route: Route::ChannelThreadMembers { channel_id, }, - params: [].into(), + params: &[], }) .await } @@ -2891,7 +2891,7 @@ impl Http { route: Route::GuildThreadsActive { guild_id, }, - params: [].into(), + params: &[], }) .await } @@ -2919,7 +2919,7 @@ impl Http { route: Route::ChannelArchivedPublicThreads { channel_id, }, - params, + params: ¶ms, }) .await } @@ -2947,7 +2947,7 @@ impl Http { route: Route::ChannelArchivedPrivateThreads { channel_id, }, - params, + params: ¶ms, }) .await } @@ -2975,7 +2975,7 @@ impl Http { route: Route::ChannelJoinedPrivateThreads { channel_id, }, - params, + params: ¶ms, }) .await } @@ -2990,7 +2990,7 @@ impl Http { route: Route::ChannelThreadMemberMe { channel_id, }, - params: [].into(), + params: &[], }) .await } @@ -3005,7 +3005,7 @@ impl Http { route: Route::ChannelThreadMemberMe { channel_id, }, - params: [].into(), + params: &[], }) .await } @@ -3025,7 +3025,7 @@ impl Http { channel_id, user_id, }, - params: [].into(), + params: &[], }) .await } @@ -3045,7 +3045,7 @@ impl Http { channel_id, user_id, }, - params: [].into(), + params: &[], }) .await } @@ -3065,7 +3065,7 @@ impl Http { channel_id, user_id, }, - params: Some([("with_member", with_member.to_string())].into()), + params: &[("with_member", with_member.to_string())], }) .await } @@ -3099,7 +3099,7 @@ impl Http { route: Route::ChannelWebhooks { channel_id, }, - params: [].into(), + params: &[], }) .await } @@ -3114,7 +3114,7 @@ impl Http { route: Route::Channel { channel_id, }, - params: [].into(), + params: &[], }) .await } @@ -3129,7 +3129,7 @@ impl Http { route: Route::GuildChannels { guild_id, }, - params: [].into(), + params: &[], }) .await } @@ -3144,7 +3144,7 @@ impl Http { route: Route::StageInstance { channel_id, }, - params: [].into(), + params: &[], }) .await } @@ -3183,7 +3183,7 @@ impl Http { message_id, answer_id, }, - params: Some(params), + params: ¶ms, }) .await?; @@ -3204,7 +3204,7 @@ impl Http { channel_id, message_id, }, - params: None, + params: &[], }) .await } @@ -3219,7 +3219,7 @@ impl Http { headers: None, method: LightMethod::Get, route: Route::Oauth2ApplicationCurrent, - params: [].into(), + params: &[], }) .await } @@ -3232,7 +3232,7 @@ impl Http { headers: None, method: LightMethod::Get, route: Route::UserMe, - params: [].into(), + params: &[], }) .await } @@ -3247,7 +3247,7 @@ impl Http { route: Route::GuildEmojis { guild_id, }, - params: [].into(), + params: &[], }) .await } @@ -3263,7 +3263,7 @@ impl Http { guild_id, emoji_id, }, - params: [].into(), + params: &[], }) .await } @@ -3315,7 +3315,7 @@ impl Http { route: Route::Entitlements { application_id: self.try_application_id()?, }, - params, + params: ¶ms, }) .await } @@ -3328,7 +3328,7 @@ impl Http { headers: None, method: LightMethod::Get, route: Route::Gateway, - params: [].into(), + params: &[], }) .await } @@ -3343,7 +3343,7 @@ impl Http { route: Route::Commands { application_id: self.try_application_id()?, }, - params: [].into(), + params: &[], }) .await } @@ -3358,7 +3358,7 @@ impl Http { route: Route::Commands { application_id: self.try_application_id()?, }, - params: [("with_localizations", String::from("true"))].into(), + params: &[("with_localizations", String::from("true"))], }) .await } @@ -3374,7 +3374,7 @@ impl Http { application_id: self.try_application_id()?, command_id, }, - params: [].into(), + params: &[], }) .await } @@ -3389,7 +3389,7 @@ impl Http { route: Route::Guild { guild_id, }, - params: [].into(), + params: &[], }) .await } @@ -3404,7 +3404,7 @@ impl Http { route: Route::Guild { guild_id, }, - params: [("with_counts", String::from("true"))].into(), + params: &[("with_counts", String::from("true"))], }) .await } @@ -3420,7 +3420,7 @@ impl Http { application_id: self.try_application_id()?, guild_id, }, - params: [].into(), + params: &[], }) .await } @@ -3440,7 +3440,7 @@ impl Http { application_id: self.try_application_id()?, guild_id, }, - params: [("with_localizations", String::from("true"))].into(), + params: &[("with_localizations", String::from("true"))], }) .await } @@ -3461,7 +3461,7 @@ impl Http { guild_id, command_id, }, - params: [].into(), + params: &[], }) .await } @@ -3480,7 +3480,7 @@ impl Http { application_id: self.try_application_id()?, guild_id, }, - params: [].into(), + params: &[], }) .await } @@ -3501,7 +3501,7 @@ impl Http { guild_id, command_id, }, - params: [].into(), + params: &[], }) .await } @@ -3518,7 +3518,7 @@ impl Http { route: Route::GuildWidget { guild_id, }, - params: [].into(), + params: &[], }) .await } @@ -3533,7 +3533,7 @@ impl Http { route: Route::GuildPreview { guild_id, }, - params: [].into(), + params: &[], }) .await } @@ -3548,7 +3548,7 @@ impl Http { route: Route::GuildWelcomeScreen { guild_id, }, - params: [].into(), + params: &[], }) .await } @@ -3563,7 +3563,7 @@ impl Http { route: Route::GuildIntegrations { guild_id, }, - params: [].into(), + params: &[], }) .await } @@ -3578,7 +3578,7 @@ impl Http { route: Route::GuildInvites { guild_id, }, - params: [].into(), + params: &[], }) .await } @@ -3598,7 +3598,7 @@ impl Http { route: Route::GuildVanityUrl { guild_id, }, - params: [].into(), + params: &[], }) .await .map(|x: GuildVanityUrl| x.code) @@ -3633,7 +3633,7 @@ impl Http { route: Route::GuildMembers { guild_id, }, - params, + params: ¶ms, }) .await?; @@ -3658,7 +3658,7 @@ impl Http { route: Route::GuildPrune { guild_id, }, - params: [("days", days.to_string())].into(), + params: &[("days", days.to_string())], }) .await } @@ -3674,7 +3674,7 @@ impl Http { route: Route::GuildRegions { guild_id, }, - params: [].into(), + params: &[], }) .await } @@ -3690,7 +3690,7 @@ impl Http { route: Route::GuildRoles { guild_id, }, - params: [].into(), + params: &[], }) .await?; @@ -3725,7 +3725,7 @@ impl Http { guild_id, event_id, }, - params: [("with_user_count", with_user_count.to_string())].into(), + params: &[("with_user_count", with_user_count.to_string())], }) .await } @@ -3748,7 +3748,7 @@ impl Http { route: Route::GuildScheduledEvents { guild_id, }, - params: [("with_user_count", with_user_count.to_string())].into(), + params: &[("with_user_count", with_user_count.to_string())], }) .await } @@ -3800,7 +3800,7 @@ impl Http { guild_id, event_id, }, - params, + params: ¶ms, }) .await } @@ -3816,7 +3816,7 @@ impl Http { route: Route::GuildStickers { guild_id, }, - params: [].into(), + params: &[], }) .await?; @@ -3847,7 +3847,7 @@ impl Http { guild_id, sticker_id, }, - params: [].into(), + params: &[], }) .await?; @@ -3887,7 +3887,7 @@ impl Http { route: Route::GuildWebhooks { guild_id, }, - params: [].into(), + params: &[], }) .await } @@ -3940,7 +3940,7 @@ impl Http { headers: None, method: LightMethod::Get, route: Route::UserMeGuilds, - params, + params: ¶ms, }) .await } @@ -3984,7 +3984,7 @@ impl Http { route: Route::UserMeGuildMember { guild_id, }, - params: [].into(), + params: &[], }) .await?; @@ -4031,7 +4031,7 @@ impl Http { route: Route::Invite { code, }, - params, + params: ¶ms, }) .await } @@ -4048,7 +4048,7 @@ impl Http { guild_id, user_id, }, - params: [].into(), + params: &[], }) .await?; @@ -4074,7 +4074,7 @@ impl Http { channel_id, message_id, }, - params: [].into(), + params: &[], }) .await } @@ -4106,7 +4106,7 @@ impl Http { route: Route::ChannelMessages { channel_id, }, - params, + params: ¶ms, }) .await } @@ -4124,7 +4124,7 @@ impl Http { headers: None, method: LightMethod::Get, route: Route::StickerPacks, - params: [].into(), + params: &[], }) .await .map(|s: StickerPacks| s.sticker_packs) @@ -4140,7 +4140,7 @@ impl Http { route: Route::ChannelPins { channel_id, }, - params: [].into(), + params: &[], }) .await } @@ -4169,7 +4169,7 @@ impl Http { message_id, reaction: &reaction_type.as_data(), }, - params, + params: ¶ms, }) .await } @@ -4184,7 +4184,7 @@ impl Http { route: Route::Skus { application_id: self.try_application_id()?, }, - params: [].into(), + params: &[], }) .await } @@ -4199,7 +4199,7 @@ impl Http { route: Route::Sticker { sticker_id, }, - params: [].into(), + params: &[], }) .await } @@ -4221,7 +4221,7 @@ impl Http { headers: None, method: LightMethod::Get, route: Route::StatusIncidentsUnresolved, - params: [].into(), + params: &[], }) .await?; @@ -4245,7 +4245,7 @@ impl Http { headers: None, method: LightMethod::Get, route: Route::StatusMaintenancesUpcoming, - params: [].into(), + params: &[], }) .await?; @@ -4262,7 +4262,7 @@ impl Http { route: Route::User { user_id, }, - params: [].into(), + params: &[], }) .await } @@ -4279,7 +4279,7 @@ impl Http { headers: None, method: LightMethod::Get, route: Route::UserMeConnections, - params: [].into(), + params: &[], }) .await } @@ -4292,7 +4292,7 @@ impl Http { headers: None, method: LightMethod::Get, route: Route::UserMeDmChannels, - params: [].into(), + params: &[], }) .await } @@ -4305,7 +4305,7 @@ impl Http { headers: None, method: LightMethod::Get, route: Route::VoiceRegions, - params: [].into(), + params: &[], }) .await } @@ -4339,7 +4339,7 @@ impl Http { route: Route::Webhook { webhook_id, }, - params: [].into(), + params: &[], }) .await } @@ -4379,7 +4379,7 @@ impl Http { webhook_id, token, }, - params: [].into(), + params: &[], }) .await } @@ -4416,7 +4416,7 @@ impl Http { webhook_id, token, }, - params: [].into(), + params: &[], }) .await } @@ -4437,7 +4437,7 @@ impl Http { guild_id, user_id, }, - params: [].into(), + params: &[], }) .await } @@ -4452,7 +4452,7 @@ impl Http { route: Route::UserMeGuild { guild_id, }, - params: [].into(), + params: &[], }) .await } @@ -4476,7 +4476,7 @@ impl Http { route: Route::ChannelMessages { channel_id, }, - params: [].into(), + params: &[], }; if files.is_empty() { @@ -4508,7 +4508,7 @@ impl Http { channel_id, message_id, }, - params: [].into(), + params: &[], }) .await } @@ -4529,7 +4529,7 @@ impl Http { guild_id, user_id, }, - params: [].into(), + params: &[], }) .await } @@ -4556,7 +4556,7 @@ impl Http { user_id, role_id, }, - params: [].into(), + params: &[], }) .await } @@ -4578,11 +4578,10 @@ impl Http { route: Route::GuildMembersSearch { guild_id, }, - params: [ + params: &[ ("query", query.to_string()), ("limit", limit.unwrap_or(constants::MEMBER_FETCH_LIMIT).to_string()), - ] - .into(), + ], }) .await?; @@ -4612,7 +4611,7 @@ impl Http { route: Route::GuildPrune { guild_id, }, - params: [("days", days.to_string())].into(), + params: &[("days", days.to_string())], }) .await } @@ -4632,7 +4631,7 @@ impl Http { guild_id, integration_id, }, - params: [].into(), + params: &[], }) .await } @@ -4693,7 +4692,7 @@ impl Http { channel_id, message_id, }, - params: [].into(), + params: &[], }) .await } @@ -4723,7 +4722,7 @@ impl Http { /// let channel_id = ChannelId::new(381880193700069377); /// let route = Route::ChannelMessages { channel_id }; /// - /// let mut request = Request::new(route, LightMethod::Post, []).body(Some(bytes)); + /// let mut request = Request::new(route, LightMethod::Post, &[]).body(Some(bytes)); /// /// let message: Message = http.fire(request).await?; /// @@ -4735,10 +4734,7 @@ impl Http { /// # Errors /// /// If there is an error, it will be either [`Error::Http`] or [`Error::Json`]. - pub async fn fire( - &self, - req: Request<'_, MAX_PARAMS>, - ) -> Result { + pub async fn fire(&self, req: Request<'_>) -> Result { let response = self.request(req).await?; decode_resp(response).await } @@ -4766,7 +4762,7 @@ impl Http { /// let channel_id = ChannelId::new(381880193700069377); /// let route = Route::ChannelMessages { channel_id }; /// - /// let mut request = Request::new(route, LightMethod::Post, []).body(Some(bytes)); + /// let mut request = Request::new(route, LightMethod::Post, &[]).body(Some(bytes)); /// /// let response = http.request(request).await?; /// @@ -4775,10 +4771,7 @@ impl Http { /// # } /// ``` #[instrument] - pub async fn request( - &self, - req: Request<'_, MAX_PARAMS>, - ) -> Result { + pub async fn request(&self, req: Request<'_>) -> Result { let method = req.method.reqwest_method(); let response = if let Some(ratelimiter) = &self.ratelimiter { ratelimiter.perform(req).await? @@ -4801,11 +4794,7 @@ impl Http { /// /// This is a function that performs a light amount of work and returns an empty tuple, so it's /// called "self.wind" to denote that it's lightweight. - pub(super) async fn wind( - &self, - expected: u16, - req: Request<'_, MAX_PARAMS>, - ) -> Result<()> { + pub(super) async fn wind(&self, expected: u16, req: Request<'_>) -> Result<()> { let method = req.method.reqwest_method(); let response = self.request(req).await?; diff --git a/src/http/ratelimiting.rs b/src/http/ratelimiting.rs index 8fa7928027e..cb6904394c5 100644 --- a/src/http/ratelimiting.rs +++ b/src/http/ratelimiting.rs @@ -179,10 +179,7 @@ impl Ratelimiter { /// /// Only error kind that may be returned is [`Error::Http`]. #[instrument] - pub async fn perform( - &self, - req: Request<'_, MAX_PARAMS>, - ) -> Result { + pub async fn perform(&self, req: Request<'_>) -> Result { loop { // This will block if another thread hit the global ratelimit. drop(self.global.lock().await); @@ -281,9 +278,9 @@ pub struct Ratelimit { impl Ratelimit { #[instrument(skip(ratelimit_callback))] - pub async fn pre_hook( + pub async fn pre_hook( &mut self, - req: &Request<'_, MAX_PARAMS>, + req: &Request<'_>, ratelimit_callback: &(dyn Fn(RatelimitInfo) + Send + Sync), ) { if self.limit() == 0 { @@ -327,10 +324,10 @@ impl Ratelimit { } #[instrument(skip(ratelimit_callback))] - pub async fn post_hook( + pub async fn post_hook( &mut self, response: &Response, - req: &Request<'_, MAX_PARAMS>, + req: &Request<'_>, ratelimit_callback: &(dyn Fn(RatelimitInfo) + Send + Sync), absolute_ratelimits: bool, ) -> Result { diff --git a/src/http/request.rs b/src/http/request.rs index 4c195a32bdd..f02aa03a01e 100644 --- a/src/http/request.rs +++ b/src/http/request.rs @@ -1,6 +1,5 @@ use std::fmt::Write; -use arrayvec::ArrayVec; use reqwest::header::{ HeaderMap as Headers, HeaderValue, @@ -20,20 +19,20 @@ use crate::internal::prelude::*; #[derive(Clone, Debug)] #[must_use] -pub struct Request<'a, const MAX_PARAMS: usize> { +pub struct Request<'a> { pub(super) body: Option>, pub(super) multipart: Option>, pub(super) headers: Option, pub(super) method: LightMethod, pub(super) route: Route<'a>, - pub(super) params: ArrayVec<(&'static str, String), MAX_PARAMS>, + pub(super) params: &'a [(&'static str, String)], } -impl<'a, const MAX_PARAMS: usize> Request<'a, MAX_PARAMS> { +impl<'a> Request<'a> { pub fn new( route: Route<'a>, method: LightMethod, - params: [(&'static str, String); MAX_PARAMS], + params: &'a [(&'static str, String)], ) -> Self { Self { body: None, @@ -41,7 +40,7 @@ impl<'a, const MAX_PARAMS: usize> Request<'a, MAX_PARAMS> { headers: None, method, route, - params: params.into(), + params, } } @@ -60,8 +59,8 @@ impl<'a, const MAX_PARAMS: usize> Request<'a, MAX_PARAMS> { self } - pub fn params(mut self, params: [(&'static str, String); MAX_PARAMS]) -> Self { - self.params = params.into(); + pub fn params(mut self, params: &'a [(&'static str, String)]) -> Self { + self.params = params; self } @@ -143,16 +142,7 @@ impl<'a, const MAX_PARAMS: usize> Request<'a, MAX_PARAMS> { if self.params.is_empty() { None } else { - Some(&self.params) - } - } - - #[must_use] - pub fn params_mut(&mut self) -> Option<&mut [(&'static str, String)]> { - if self.params.is_empty() { - None - } else { - Some(&mut self.params) + Some(self.params) } } }