Skip to content

Commit

Permalink
fix: enable to use attribute use_default for generic type. (#264)
Browse files Browse the repository at this point in the history
  • Loading branch information
mythrnr authored Jun 21, 2024
1 parent 4d1490c commit 657d64a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions raiden-derive/src/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 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 @@ -394,6 +394,8 @@ mod tests {
id: String,
#[raiden(use_default)]
flag: bool,
#[raiden(use_default)]
type_param: std::collections::BTreeSet<usize>,
}

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

0 comments on commit 657d64a

Please sign in to comment.