mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-01-22 12:56:33 +00:00
Clean up code a bit
This commit is contained in:
parent
738d5f9403
commit
38ad6555eb
1 changed files with 4 additions and 9 deletions
13
src/zalsa.rs
13
src/zalsa.rs
|
@ -314,17 +314,12 @@ impl JarAux for JarAuxImpl<'_> {
|
|||
ingredient_index: IngredientIndex,
|
||||
) -> MemoIngredientIndex {
|
||||
let mut memo_ingredients = self.0.memo_ingredient_indices.write();
|
||||
let memo_ingredients = if let Some(memo_ingredients) =
|
||||
memo_ingredients.get_mut(struct_ingredient_index.as_usize())
|
||||
{
|
||||
let idx = struct_ingredient_index.as_usize();
|
||||
let memo_ingredients = if let Some(memo_ingredients) = memo_ingredients.get_mut(idx) {
|
||||
memo_ingredients
|
||||
} else {
|
||||
while memo_ingredients.len() <= struct_ingredient_index.as_usize() {
|
||||
memo_ingredients.push(Vec::new());
|
||||
}
|
||||
memo_ingredients
|
||||
.get_mut(struct_ingredient_index.as_usize())
|
||||
.unwrap()
|
||||
memo_ingredients.resize_with(idx + 1, Vec::new);
|
||||
memo_ingredients.get_mut(idx).unwrap()
|
||||
};
|
||||
let mi = MemoIngredientIndex(u32::try_from(memo_ingredients.len()).unwrap());
|
||||
memo_ingredients.push(ingredient_index);
|
||||
|
|
Loading…
Reference in a new issue