From 8409ebc6a1efb20902895926bed654d7e8fd6a8c Mon Sep 17 00:00:00 2001 From: Michael Krasnitski Date: Fri, 3 Jan 2025 22:22:47 -0500 Subject: [PATCH] Fix clippy lints --- src/http/client.rs | 26 +++++++++++++------------- src/internal/macros.rs | 2 +- src/model/colour.rs | 2 +- src/model/id.rs | 4 ++-- src/model/permissions.rs | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/http/client.rs b/src/http/client.rs index 6040731253f..9613ab05620 100644 --- a/src/http/client.rs +++ b/src/http/client.rs @@ -881,7 +881,7 @@ impl Http { map.insert("guild_id".to_string(), guild_id.get().into()); } - from_value(value).map_err(From::from) + from_value(value) } /// Creates a Guild Scheduled Event. @@ -1946,7 +1946,7 @@ impl Http { map.insert("guild_id".to_string(), guild_id.get().into()); } - from_value::(value).map_err(From::from) + from_value::(value) } /// Edits a message by Id. @@ -2171,7 +2171,7 @@ impl Http { map.insert("guild_id".to_string(), guild_id.get().into()); } - from_value(value).map_err(From::from) + from_value(value) } /// Changes the position of a role in a guild. @@ -2209,7 +2209,7 @@ impl Http { } } - from_value(value).map_err(From::from) + from_value(value) } /// Modifies a scheduled event. @@ -2269,7 +2269,7 @@ impl Http { map.insert("guild_id".to_string(), guild_id.get().into()); } - from_value(value).map_err(From::from) + from_value(value) } /// Edits a thread channel in the [`GuildChannel`] given its Id. @@ -3750,7 +3750,7 @@ impl Http { } } - from_value(value).map_err(From::from) + from_value(value) } /// Gets the amount of users that can be pruned. @@ -3804,7 +3804,7 @@ impl Http { map.insert("guild_id".to_string(), guild_id.get().into()); } - from_value(value).map_err(From::from) + from_value(value) } /// Retrieves a list of roles in a [`Guild`]. @@ -3830,7 +3830,7 @@ impl Http { } } - from_value(value).map_err(From::from) + from_value(value) } /// Gets a scheduled event by Id. @@ -3956,7 +3956,7 @@ impl Http { } } - from_value(value).map_err(From::from) + from_value(value) } /// Retrieves a single sticker in a [`Guild`]. @@ -3983,7 +3983,7 @@ impl Http { map.insert("guild_id".to_string(), guild_id.get().into()); } - from_value(value).map_err(From::from) + from_value(value) } /// Retrieves the webhooks for the given [guild][`Guild`]'s Id. @@ -4120,7 +4120,7 @@ impl Http { map.insert("guild_id".to_string(), guild_id.get().into()); } - from_value(value).map_err(From::from) + from_value(value) } /// Gets information about a specific invite. @@ -4185,7 +4185,7 @@ impl Http { map.insert("guild_id".to_string(), guild_id.get().into()); } - from_value(value).map_err(From::from) + from_value(value) } /// Gets a message by an Id, bots only. @@ -4736,7 +4736,7 @@ impl Http { } } - from_value(value).map_err(From::from) + from_value(value) } /// Starts removing some members from a guild based on the last time they've been online. diff --git a/src/internal/macros.rs b/src/internal/macros.rs index 9b437882acd..432377c161a 100644 --- a/src/internal/macros.rs +++ b/src/internal/macros.rs @@ -145,7 +145,7 @@ macro_rules! bitflags { } ) => { $(#[$outer])* - #[repr(packed)] + #[repr(Rust, packed)] $vis struct $BitFlags($T); bitflags::bitflags! { diff --git a/src/model/colour.rs b/src/model/colour.rs index 574565acbbf..2fd40a243d4 100644 --- a/src/model/colour.rs +++ b/src/model/colour.rs @@ -124,7 +124,7 @@ impl Colour { #[allow(clippy::cast_lossless)] #[must_use] pub const fn from_rgb(red: u8, green: u8, blue: u8) -> Colour { - Colour((red as u32) << 16 | (green as u32) << 8 | blue as u32) + Colour(((red as u32) << 16) | ((green as u32) << 8) | blue as u32) } /// Returns the red RGB component of this Colour. diff --git a/src/model/id.rs b/src/model/id.rs index f1d965b89fa..39cd9ce4825 100644 --- a/src/model/id.rs +++ b/src/model/id.rs @@ -138,7 +138,7 @@ macro_rules! id_u64 { /// The inner storage of an ID. #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] -#[repr(packed)] +#[repr(Rust, packed)] pub(crate) struct InnerId(NonZeroU64); struct SnowflakeVisitor; @@ -235,7 +235,7 @@ newtype_display_impl!(ShardId, |this| this.0); /// The specific algorithm used is currently just a sequential index but this is subject to change. #[cfg_attr(feature = "typesize", derive(typesize::derive::TypeSize))] #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord, Deserialize, Serialize)] -#[repr(packed)] +#[repr(Rust, packed)] pub struct AnswerId(u8); impl AnswerId { diff --git a/src/model/permissions.rs b/src/model/permissions.rs index 7451dc67fc2..fd38ebae8d9 100644 --- a/src/model/permissions.rs +++ b/src/model/permissions.rs @@ -265,7 +265,7 @@ pub const PRESET_VOICE: Permissions = Permissions::from_bits_truncate( /// [`User`]: super::user::User #[cfg_attr(feature = "typesize", derive(typesize::derive::TypeSize))] #[derive(Copy, Clone, Default, Debug, Eq, Hash, PartialEq)] -#[repr(packed)] +#[repr(Rust, packed)] pub struct Permissions(u64); generate_permissions! {