diff --git a/src/http/client.rs b/src/http/client.rs index 2feb761c8ef..f7a2e879f84 100644 --- a/src/http/client.rs +++ b/src/http/client.rs @@ -837,7 +837,7 @@ impl Http { map.insert("guild_id".to_string(), guild_id.get().into()); } - from_value(value) + from_value(value).map_err(From::from) } /// Creates a Guild Scheduled Event. @@ -1777,7 +1777,7 @@ impl Http { map.insert("guild_id".to_string(), guild_id.get().into()); } - from_value::(value) + from_value::(value).map_err(From::from) } /// Edits a message by Id. @@ -1990,7 +1990,7 @@ impl Http { map.insert("guild_id".to_string(), guild_id.get().into()); } - from_value(value) + from_value(value).map_err(From::from) } /// Changes the positions of roles in a guild. @@ -2023,7 +2023,7 @@ impl Http { } } - from_value(value) + from_value(value).map_err(From::from) } /// Modifies a scheduled event. @@ -2083,7 +2083,7 @@ impl Http { map.insert("guild_id".to_string(), guild_id.get().into()); } - from_value(value) + from_value(value).map_err(From::from) } /// Edits a thread channel in the [`GuildChannel`] given its Id. @@ -3427,7 +3427,7 @@ impl Http { } } - from_value(value) + from_value(value).map_err(From::from) } /// Gets the amount of users that can be pruned. @@ -3482,7 +3482,7 @@ impl Http { map.insert("guild_id".to_string(), guild_id.get().into()); } - from_value(value) + from_value(value).map_err(From::from) } /// Retrieves a list of roles in a [`Guild`]. @@ -3508,7 +3508,7 @@ impl Http { } } - from_value(value) + from_value(value).map_err(From::from) } /// Gets a scheduled event by Id. @@ -3620,7 +3620,7 @@ impl Http { } } - from_value(value) + from_value(value).map_err(From::from) } /// Retrieves a single sticker in a [`Guild`]. @@ -3647,7 +3647,7 @@ impl Http { map.insert("guild_id".to_string(), guild_id.get().into()); } - from_value(value) + from_value(value).map_err(From::from) } /// Retrieves the webhooks for the given [`Guild`]'s Id. @@ -3721,7 +3721,7 @@ impl Http { map.insert("guild_id".to_string(), guild_id.get().into()); } - from_value(value) + from_value(value).map_err(From::from) } /// Gets information about a specific invite. @@ -3782,7 +3782,7 @@ impl Http { map.insert("guild_id".to_string(), guild_id.get().into()); } - from_value(value) + from_value(value).map_err(From::from) } /// Gets a message by an Id, bots only. @@ -4288,7 +4288,7 @@ impl Http { } } - from_value(value) + from_value(value).map_err(From::from) } /// Starts removing some members from a guild based on the last time they've been online. diff --git a/src/utils/content_safe.rs b/src/utils/content_safe.rs index d34993f9f74..b7513730699 100644 --- a/src/utils/content_safe.rs +++ b/src/utils/content_safe.rs @@ -34,7 +34,7 @@ pub struct ContentSafeOptions { /// /// This option is ignored if the username is a next-gen username, and /// therefore does not have a discriminator. - #[deprecated = "Discriminators are deprecated on the discord side, and this doesn't reflect message rendering behaviour"] + #[cfg_attr(not(ignore_serenity_deprecated), deprecated = "Discriminators are deprecated on the discord side, and this doesn't reflect message rendering behaviour")] pub show_discriminator: bool, } @@ -177,7 +177,7 @@ fn clean_mention( Mention::User(id) => { if let Some(member) = guild.members.get(&id) { if options.get_show_discriminator() { - #[allow(deprecated)] + #[expect(deprecated)] let name = member.distinct(); format!("@{name}").into() } else { @@ -276,14 +276,6 @@ mod tests { content_safe(&no_member_guild, "<@!100000000000000000>", options, &[]) ); - #[allow(deprecated)] - let options = options.show_discriminator(false); - assert_eq!( - format!("@{}", user.name), - content_safe(&no_member_guild, "<@100000000000000000>", &options, &[]) - ); - - let options = options.display_as_member_from(guild.id); assert_eq!( format!("@{}", member.nick.as_ref().unwrap()), content_safe(&guild, "<@100000000000000000>", options, &[])