Skip to content

Commit

Permalink
derive: any fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jordens committed Sep 23, 2024
1 parent ea15501 commit 7afce8f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions miniconf/tests/enum.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use miniconf::{JsonCoreSlash, Path, Tree, TreeDeserialize, TreeKey, TreeSerialize};
use miniconf::{JsonCoreSlash, Path, Tree, TreeKey};

#[test]
fn newtype_enums() {
Expand All @@ -7,7 +7,7 @@ fn newtype_enums() {
a: i32,
}

#[derive(TreeKey, TreeSerialize, TreeDeserialize, Default)]
#[derive(Tree, Default)]
enum Settings {
#[default]
Unit,
Expand Down
8 changes: 4 additions & 4 deletions miniconf_derive/src/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,11 @@ impl TreeField {
if depth > 0 {
quote! {
#lhs => #getter
.and_then(|value| ::miniconf::TreeAny::<#depth>::ref_any_by_key(value, keys))
.and_then(|item| ::miniconf::TreeAny::<#depth>::ref_any_by_key(item, keys))
}
} else {
quote! {
#lhs => #getter.map(|value| value as &dyn ::core::any::Any)
#lhs => #getter.map(|item| item as &dyn ::core::any::Any)
}
}
}
Expand All @@ -180,11 +180,11 @@ impl TreeField {
if depth > 0 {
quote! {
#lhs => #getter_mut
.and_then(|value| ::miniconf::TreeAny::<#depth>::mut_any_by_key(value, keys))
.and_then(|item| ::miniconf::TreeAny::<#depth>::mut_any_by_key(item, keys))
}
} else {
quote! {
#lhs => #getter_mut.map(|value| value as &mut dyn ::core::any::Any)
#lhs => #getter_mut.map(|item| item as &mut dyn ::core::any::Any)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion miniconf_derive/src/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ impl Tree {
// Note(unreachable) empty structs have diverged by now
#[allow(unreachable_code)]
{
let ret: Result<_, _> = match index {
let ret: Result<_, _> = match #mat {
#(#mut_arms ,)*
_ => #default
};
Expand Down

0 comments on commit 7afce8f

Please sign in to comment.