Skip to content

Commit 8aed78a

Browse files
authored
Fix nesting with status feature (#101)
1 parent f9d60b6 commit 8aed78a

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ members = [
77

88
[workspace.package]
99
authors = ["Antonio Yang <[email protected]>"]
10-
version = "0.10.2"
10+
version = "0.10.3"
1111
edition = "2021"
1212
categories = ["development-tools"]
1313
keywords = ["struct", "patch", "macro", "derive", "overlay"]

struct-patch-derive/src/patch.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,11 @@ impl Patch {
139139
return false
140140
}
141141
)*
142+
#(
143+
if !self.#nesting_field_names.is_empty() {
144+
return false
145+
}
146+
)*
142147
true
143148
}
144149
}

struct-patch/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ license.workspace = true
1111
readme.workspace = true
1212

1313
[dependencies]
14-
struct-patch-derive = { version = "=0.10.2", path = "../struct-patch-derive" }
14+
struct-patch-derive = { version = "=0.10.3", path = "../struct-patch-derive" }
1515

1616
[dev-dependencies]
1717
serde_json = "1.0"

struct-patch/examples/nesting.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use serde::Deserialize;
22
use struct_patch::Patch;
3+
#[cfg(feature = "status")]
4+
use struct_patch::Status;
35

46
#[cfg(feature = "nesting")]
57
#[derive(Clone, Debug, Default, Patch, PartialEq)]
@@ -48,6 +50,9 @@ fn main() {
4850
}"#;
4951
assert_eq!(patch, serde_json::from_str(data).unwrap());
5052

53+
#[cfg(feature = "status")]
54+
assert!(!patch.is_empty());
55+
5156
let mut item = Item::default();
5257
item.apply(patch);
5358
assert_eq!(item, item_b);

0 commit comments

Comments
 (0)