Skip to content

Commit

Permalink
fix: enable to use attribute use_default for generic type.
Browse files Browse the repository at this point in the history
  • Loading branch information
mythrnr committed Jun 21, 2024
1 parent 5fdd697 commit 96ab27b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions raiden-derive/src/aws_sdk/ops/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 item.is_null() {
#ty::default()
Default::default()
} else {
let converted = ::raiden::FromAttribute::from_attr(Some(item));
if converted.is_err() {
Expand Down
4 changes: 2 additions & 2 deletions raiden-derive/src/rusoto/ops/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,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() {
Expand Down
3 changes: 3 additions & 0 deletions raiden/tests/all/get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,8 @@ mod tests {
id: String,
#[raiden(use_default)]
flag: bool,
#[raiden(use_default)]
type_param: std::collections::BTreeSet<usize>,
}

#[tokio::test]
Expand All @@ -337,6 +339,7 @@ mod tests {
item: UseDefaultForNull {
id: "id0".to_owned(),
flag: false,
type_param: Default::default(),
},
consumed_capacity: None,
}
Expand Down

0 comments on commit 96ab27b

Please sign in to comment.