diff --git a/strum_macros/src/macros/enum_iter.rs b/strum_macros/src/macros/enum_iter.rs index a006d85d..515160ca 100644 --- a/strum_macros/src/macros/enum_iter.rs +++ b/strum_macros/src/macros/enum_iter.rs @@ -96,7 +96,7 @@ pub fn enum_iter_inner(ast: &DeriveInput) -> syn::Result { impl #impl_generics Iterator for #iter_name #ty_generics #where_clause { type Item = #name #ty_generics; - fn next(&mut self) -> Option { + fn next(&mut self) -> Option<::Item> { self.nth(0) } @@ -105,7 +105,7 @@ pub fn enum_iter_inner(ast: &DeriveInput) -> syn::Result { (t, Some(t)) } - fn nth(&mut self, n: usize) -> Option { + fn nth(&mut self, n: usize) -> Option<::Item> { let idx = self.idx + n + 1; if idx + self.back_idx > #variant_count { // We went past the end of the iterator. Freeze idx at #variant_count @@ -127,7 +127,7 @@ pub fn enum_iter_inner(ast: &DeriveInput) -> syn::Result { } impl #impl_generics DoubleEndedIterator for #iter_name #ty_generics #where_clause { - fn next_back(&mut self) -> Option { + fn next_back(&mut self) -> Option<::Item> { let back_idx = self.back_idx + 1; if self.idx + back_idx > #variant_count { diff --git a/strum_macros/src/macros/strings/from_string.rs b/strum_macros/src/macros/strings/from_string.rs index 8a6c40f7..28829817 100644 --- a/strum_macros/src/macros/strings/from_string.rs +++ b/strum_macros/src/macros/strings/from_string.rs @@ -91,7 +91,7 @@ pub fn from_string_inner(ast: &DeriveInput) -> syn::Result { #[allow(clippy::use_self)] impl #impl_generics ::core::str::FromStr for #name #ty_generics #where_clause { type Err = #strum_module_path::ParseError; - fn from_str(s: &str) -> ::core::result::Result< #name #ty_generics , Self::Err> { + fn from_str(s: &str) -> ::core::result::Result< #name #ty_generics , ::Err> { match s { #(#arms),* } @@ -136,7 +136,7 @@ fn try_from_str( #[allow(clippy::use_self)] impl #impl_generics ::core::convert::TryFrom<&str> for #name #ty_generics #where_clause { type Error = #strum_module_path::ParseError; - fn try_from(s: &str) -> ::core::result::Result< #name #ty_generics , Self::Error> { + fn try_from(s: &str) -> ::core::result::Result< #name #ty_generics , >::Error> { ::core::str::FromStr::from_str(s) } }