File tree Expand file tree Collapse file tree 1 file changed +2
-8
lines changed Expand file tree Collapse file tree 1 file changed +2
-8
lines changed Original file line number Diff line number Diff line change @@ -255,11 +255,7 @@ impl Zalsa {
255255 /// Returns the ingredient at the given index, or panics if it is out-of-bounds.
256256 #[ inline]
257257 pub fn lookup_ingredient ( & self , index : IngredientIndex ) -> & dyn Ingredient {
258- let index = index. as_u32 ( ) as usize ;
259- self . ingredients_vec
260- . get ( index)
261- . unwrap_or_else ( || panic ! ( "index `{index}` is uninitialized" ) )
262- . as_ref ( )
258+ self . ingredients_vec [ index. as_u32 ( ) as usize ] . as_ref ( )
263259 }
264260
265261 /// Returns the ingredient at the given index.
@@ -269,10 +265,8 @@ impl Zalsa {
269265 /// The index must be in-bounds.
270266 #[ inline]
271267 pub unsafe fn lookup_ingredient_unchecked ( & self , index : IngredientIndex ) -> & dyn Ingredient {
272- let index = index. as_u32 ( ) as usize ;
273-
274268 // SAFETY: Guaranteed by caller.
275- unsafe { self . ingredients_vec . get_unchecked ( index) . as_ref ( ) }
269+ unsafe { self . ingredients_vec . get_unchecked ( index. as_u32 ( ) as usize ) . as_ref ( ) }
276270 }
277271
278272 pub ( crate ) fn ingredient_index_for_memo (
You can’t perform that action at this time.
0 commit comments