Skip to content

Commit 136e508

Browse files
author
Seulgi Kim
committed
Cleanup require_item_or_from function
1 parent c5f8555 commit 136e508

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

state/src/item/cache.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -279,15 +279,12 @@ where
279279

280280
match &mut entry.item {
281281
Some(_) => {}
282-
slot => *slot = Some(Item::default()),
282+
slot @ None => *slot = Some(Item::default()),
283283
}
284284

285285
// set the dirty flag after changing data.
286286
entry.state = EntryState::Dirty;
287-
match entry.item {
288-
Some(ref mut item) => item,
289-
_ => panic!("Required item must always exist; qed"),
290-
}
287+
entry.item.as_mut().expect("Required item must always exist; qed")
291288
}))
292289
}
293290
}

0 commit comments

Comments
 (0)