Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 00e969d

Browse files
committed
feat: improve valid check
1 parent f3a640b commit 00e969d

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

  • libs/jwst-codec/src/doc/codec

libs/jwst-codec/src/doc/codec/item.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,8 @@ impl Item {
8989

9090
pub(crate) fn is_valid(&self) -> bool {
9191
let has_id = self.left_id.is_some() || self.right_id.is_some();
92-
if self.parent.is_some() && has_id {
93-
return false;
94-
} else if self.parent.is_none() && !has_id {
95-
return false;
96-
} else if self.parent_sub.is_some() && has_id {
97-
return false;
98-
}
99-
return true;
92+
!has_id && self.parent.is_some()
93+
|| has_id && self.parent.is_none() && self.parent_sub.is_none()
10094
}
10195

10296
pub(crate) fn write<W: CrdtWriter>(&self, encoder: &mut W) -> JwstCodecResult {

0 commit comments

Comments
 (0)