diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 1227f04326a..c6b4d65c603 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -148,6 +148,9 @@ jobs: - name: Install cargo-minimal-versions uses: taiki-e/install-action@cargo-minimal-versions + - name: Work around old serde_derive version error + run: cargo add -p twilight-model serde_derive@1.0.113 + - name: Check minimal versions run: cargo minimal-versions check diff --git a/twilight-cache-inmemory/src/lib.rs b/twilight-cache-inmemory/src/lib.rs index 88337d488f9..2647da257bb 100644 --- a/twilight-cache-inmemory/src/lib.rs +++ b/twilight-cache-inmemory/src/lib.rs @@ -131,7 +131,7 @@ impl Debug for Reference<'_, K, V> { } } -impl<'a, K: Eq + Hash, V> Deref for Reference<'a, K, V> { +impl Deref for Reference<'_, K, V> { type Target = V; fn deref(&self) -> &Self::Target { diff --git a/twilight-gateway/src/stream.rs b/twilight-gateway/src/stream.rs index 933d0cfa148..cd4859b3f1c 100644 --- a/twilight-gateway/src/stream.rs +++ b/twilight-gateway/src/stream.rs @@ -104,8 +104,8 @@ mod private { } } - impl<'a, St: ?Sized + Stream> + Unpin> Future - for NextEvent<'a, St> + impl> + Unpin> Future + for NextEvent<'_, St> { type Output = Option>; diff --git a/twilight-http/src/routing.rs b/twilight-http/src/routing.rs index 1c4f8e39d80..0f3b3c2ba29 100644 --- a/twilight-http/src/routing.rs +++ b/twilight-http/src/routing.rs @@ -1187,7 +1187,7 @@ pub enum Route<'a> { UpdateCurrentUserApplication, } -impl<'a> Route<'a> { +impl Route<'_> { /// HTTP method of the route. /// /// # Examples diff --git a/twilight-lavalink/src/lib.rs b/twilight-lavalink/src/lib.rs index 367a4bf3ce8..8a306baa7a6 100644 --- a/twilight-lavalink/src/lib.rs +++ b/twilight-lavalink/src/lib.rs @@ -9,7 +9,8 @@ #![allow( clippy::module_name_repetitions, clippy::must_use_candidate, - clippy::unnecessary_wraps + clippy::unnecessary_wraps, + clippy::used_underscore_items )] pub mod client; diff --git a/twilight-mention/src/parse/iter.rs b/twilight-mention/src/parse/iter.rs index 5ef616468d2..83fd8013f9d 100644 --- a/twilight-mention/src/parse/iter.rs +++ b/twilight-mention/src/parse/iter.rs @@ -51,7 +51,7 @@ impl<'a, T> MentionIter<'a, T> { } } -impl<'a, T: ParseMention> Iterator for MentionIter<'a, T> { +impl Iterator for MentionIter<'_, T> { /// Found mention followed by the start and ending indexes in the source /// string returned by [`as_str`]. /// diff --git a/twilight-model/src/gateway/event/dispatch.rs b/twilight-model/src/gateway/event/dispatch.rs index cc6b0971525..6ced713cca6 100644 --- a/twilight-model/src/gateway/event/dispatch.rs +++ b/twilight-model/src/gateway/event/dispatch.rs @@ -245,7 +245,7 @@ impl<'a> DispatchEventWithTypeDeserializer<'a> { } } -impl<'de, 'a> DeserializeSeed<'de> for DispatchEventWithTypeDeserializer<'a> { +impl<'de> DeserializeSeed<'de> for DispatchEventWithTypeDeserializer<'_> { type Value = DispatchEvent; #[allow(clippy::too_many_lines)] diff --git a/twilight-model/src/guild/permissions.rs b/twilight-model/src/guild/permissions.rs index 9d5de9705bb..afc67dcf752 100644 --- a/twilight-model/src/guild/permissions.rs +++ b/twilight-model/src/guild/permissions.rs @@ -89,7 +89,7 @@ bitflags! { struct PermissionsVisitor; -impl<'de> Visitor<'de> for PermissionsVisitor { +impl Visitor<'_> for PermissionsVisitor { type Value = Permissions; fn expecting(&self, f: &mut Formatter<'_>) -> FmtResult { diff --git a/twilight-model/src/lib.rs b/twilight-model/src/lib.rs index be628aa556b..511497a749b 100644 --- a/twilight-model/src/lib.rs +++ b/twilight-model/src/lib.rs @@ -3,7 +3,8 @@ #![allow( clippy::module_name_repetitions, clippy::must_use_candidate, - clippy::semicolon_if_nothing_returned + clippy::semicolon_if_nothing_returned, + clippy::used_underscore_items )] pub mod application; diff --git a/twilight-model/src/user/mod.rs b/twilight-model/src/user/mod.rs index 45a4bd25758..953b76a5b2b 100644 --- a/twilight-model/src/user/mod.rs +++ b/twilight-model/src/user/mod.rs @@ -29,7 +29,7 @@ pub(crate) mod discriminator { struct DiscriminatorVisitor; - impl<'de> Visitor<'de> for DiscriminatorVisitor { + impl Visitor<'_> for DiscriminatorVisitor { type Value = u16; fn expecting(&self, f: &mut Formatter<'_>) -> FmtResult { diff --git a/twilight-model/src/util/hex_color.rs b/twilight-model/src/util/hex_color.rs index 57cd86a1983..55e7d0a6297 100644 --- a/twilight-model/src/util/hex_color.rs +++ b/twilight-model/src/util/hex_color.rs @@ -72,7 +72,7 @@ impl FromStr for HexColor { struct HexColorVisitor; -impl<'de> Visitor<'de> for HexColorVisitor { +impl Visitor<'_> for HexColorVisitor { type Value = HexColor; fn expecting(&self, formatter: &mut Formatter) -> FmtResult { diff --git a/twilight-model/src/util/mustbe.rs b/twilight-model/src/util/mustbe.rs index f9b65632b26..6e666f8b21e 100644 --- a/twilight-model/src/util/mustbe.rs +++ b/twilight-model/src/util/mustbe.rs @@ -20,7 +20,7 @@ impl<'de, const T: bool> Deserialize<'de> for MustBeBool { { struct MustBeBoolVisitor(bool); - impl<'de> Visitor<'de> for MustBeBoolVisitor { + impl Visitor<'_> for MustBeBoolVisitor { type Value = (); fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { diff --git a/twilight-model/src/visitor.rs b/twilight-model/src/visitor.rs index b9cc5d6bf8d..23d102b5d61 100644 --- a/twilight-model/src/visitor.rs +++ b/twilight-model/src/visitor.rs @@ -14,7 +14,7 @@ pub mod null_boolean { struct NullBooleanVisitor; - impl<'de> Visitor<'de> for NullBooleanVisitor { + impl Visitor<'_> for NullBooleanVisitor { type Value = bool; fn expecting(&self, f: &mut Formatter<'_>) -> FmtResult { @@ -111,7 +111,7 @@ pub mod zeroable_id { // Clippy will say this bool can be taken by value, but we need it to be // passed by reference because that's what serde does. - #[allow(clippy::trivially_copy_pass_by_ref)] + #[allow(clippy::ref_option, clippy::trivially_copy_pass_by_ref)] pub fn serialize( value: &Option>, serializer: S, diff --git a/twilight-util/src/lib.rs b/twilight-util/src/lib.rs index 073acfc62f7..a3db360e552 100644 --- a/twilight-util/src/lib.rs +++ b/twilight-util/src/lib.rs @@ -9,7 +9,8 @@ #![allow( clippy::module_name_repetitions, clippy::must_use_candidate, - clippy::unnecessary_wraps + clippy::unnecessary_wraps, + clippy::used_underscore_items )] #[cfg(feature = "builder")] diff --git a/twilight-validate/src/command.rs b/twilight-validate/src/command.rs index 9ded036e702..170fbc7087d 100644 --- a/twilight-validate/src/command.rs +++ b/twilight-validate/src/command.rs @@ -360,10 +360,10 @@ pub fn command(value: &Command) -> Result<(), CommandValidationError> { /// Calculate the total character count of a command. pub fn command_characters(command: &Command) -> usize { let mut characters = - longest_localization_characters(&command.name, &command.name_localizations) + longest_localization_characters(&command.name, command.name_localizations.as_ref()) + longest_localization_characters( &command.description, - &command.description_localizations, + command.description_localizations.as_ref(), ); for option in &command.options { @@ -377,9 +377,11 @@ pub fn command_characters(command: &Command) -> usize { pub fn option_characters(option: &CommandOption) -> usize { let mut characters = 0; - characters += longest_localization_characters(&option.name, &option.name_localizations); - characters += - longest_localization_characters(&option.description, &option.description_localizations); + characters += longest_localization_characters(&option.name, option.name_localizations.as_ref()); + characters += longest_localization_characters( + &option.description, + option.description_localizations.as_ref(), + ); match option.kind { CommandOptionType::String => { @@ -388,7 +390,7 @@ pub fn option_characters(option: &CommandOption) -> usize { if let CommandOptionChoiceValue::String(string_choice) = &choice.value { characters += longest_localization_characters( &choice.name, - &choice.name_localizations, + choice.name_localizations.as_ref(), ) + string_choice.len(); } } @@ -415,7 +417,7 @@ pub fn option_characters(option: &CommandOption) -> usize { /// instead. fn longest_localization_characters( default: &str, - localizations: &Option>, + localizations: Option<&HashMap>, ) -> usize { let mut characters = default.len();