From 657d64a417d39c600413c3dcef0afcafbfe6039d Mon Sep 17 00:00:00 2001 From: mythrnr <32730704+mythrnr@users.noreply.github.com> Date: Fri, 21 Jun 2024 19:51:53 +0900 Subject: [PATCH] fix: enable to use attribute use_default for generic type. (#264) --- raiden-derive/src/ops/shared.rs | 4 ++-- raiden/tests/all/get.rs | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/raiden-derive/src/ops/shared.rs b/raiden-derive/src/ops/shared.rs index 015034e6..dce4da44 100644 --- a/raiden-derive/src/ops/shared.rs +++ b/raiden-derive/src/ops/shared.rs @@ -41,12 +41,12 @@ pub(crate) fn expand_attr_to_item( #ident: { #item if item.is_none() { - #ty::default() + Default::default() } else { let item = item.unwrap(); // If null is true, use default value. if let Some(true) = item.null { - #ty::default() + Default::default() } else { let converted = ::raiden::FromAttribute::from_attr(Some(item)); if converted.is_err() { diff --git a/raiden/tests/all/get.rs b/raiden/tests/all/get.rs index 9b22732a..10e6ec34 100644 --- a/raiden/tests/all/get.rs +++ b/raiden/tests/all/get.rs @@ -394,6 +394,8 @@ mod tests { id: String, #[raiden(use_default)] flag: bool, + #[raiden(use_default)] + type_param: std::collections::BTreeSet, } #[tokio::test] @@ -410,6 +412,7 @@ mod tests { item: UseDefaultForNull { id: "id0".to_owned(), flag: false, + type_param: Default::default(), }, consumed_capacity: None, }