From fb442298ddf650c4666d3263fa0c9b28df2e63f4 Mon Sep 17 00:00:00 2001 From: Jonathan Creekmore Date: Fri, 4 Oct 2024 04:11:25 -0500 Subject: [PATCH] call `EnumIter::get` using fully qualified syntax (#2321) * call `EnumIter::get` using fully qualified syntax `itertools` version 0.13.0 added a `get` method that takes precedence over the `EnumIter::get` method. The `EnumIter` derive should be calling the method fully-qualified to ensure that the local version is called rather than the method that is provided by the `Itertools` trait. This was fixed in `strum` 0.26.x, but since this is a forked/adapted version of the `EnumIter` derive, it requires the same fix . * CHANGELOG --------- Co-authored-by: Billy Chan --- CHANGELOG.md | 4 ++++ sea-orm-macros/src/strum/enum_iter.rs | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 371c45c15..d900d09f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). + `1.1.0-rc.1`: 2024-08-09 +### Enhancements + +* [sea-orm-macros] Call `EnumIter::get` using fully qualified syntax https://github.com/SeaQL/sea-orm/pull/2321 + ### Upgrades * Upgrade `sqlx` to `0.8.2` https://github.com/SeaQL/sea-orm/pull/2305, https://github.com/SeaQL/sea-orm/pull/2371 diff --git a/sea-orm-macros/src/strum/enum_iter.rs b/sea-orm-macros/src/strum/enum_iter.rs index ef84b4592..4c2e498cd 100644 --- a/sea-orm-macros/src/strum/enum_iter.rs +++ b/sea-orm-macros/src/strum/enum_iter.rs @@ -131,7 +131,7 @@ pub fn enum_iter_inner(ast: &DeriveInput) -> syn::Result { ::core::option::Option::None } else { self.idx = idx; - self.get(idx - 1) + #iter_name::get(self, idx - 1) } } } @@ -154,7 +154,7 @@ pub fn enum_iter_inner(ast: &DeriveInput) -> syn::Result { ::core::option::Option::None } else { self.back_idx = back_idx; - self.get(#variant_count - self.back_idx) + #iter_name::get(self, #variant_count - self.back_idx) } } }