Skip to content

Commit e5d997b

Browse files
author
Zoran Cvetkov
committed
moved fn remove_vid
1 parent 522d7f7 commit e5d997b

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

graph/src/components/store/entity_cache.rs

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,20 @@ impl EntityCache {
212212
// a legacy subgraph that has VID autoincremented while this trait
213213
// always creates it in a new style.
214214
debug_assert!(match scope {
215-
GetScope::Store =>
216-
remove_vid(entity.clone()) == remove_vid(self.store.get(key).unwrap().map(Arc::new)),
215+
GetScope::Store => {
216+
// Release build will never call this function and hence it's OK
217+
// when that implementation is not correct.
218+
fn remove_vid(entity: Option<Arc<Entity>>) -> Option<Entity> {
219+
entity.map(|e| {
220+
#[allow(unused_mut)]
221+
let mut entity = (*e).clone();
222+
#[cfg(debug_assertions)]
223+
entity.remove("vid");
224+
entity
225+
})
226+
}
227+
remove_vid(entity.clone()) == remove_vid(self.store.get(key).unwrap().map(Arc::new))
228+
}
217229
GetScope::InBlock => true,
218230
});
219231

@@ -558,18 +570,3 @@ impl EntityCache {
558570
})
559571
}
560572
}
561-
562-
// Release build still needs this function althought it will never call it
563-
#[cfg(not(debug_assertions))]
564-
fn remove_vid(_: Option<Arc<Entity>>) -> Option<Entity> {
565-
None
566-
}
567-
568-
#[cfg(debug_assertions)]
569-
fn remove_vid(entity: Option<Arc<Entity>>) -> Option<Entity> {
570-
entity.map(|e| {
571-
let mut entity = (*e).clone();
572-
entity.remove("vid");
573-
entity
574-
})
575-
}

0 commit comments

Comments
 (0)