Change expect("exists") to unwrap().
This commit is contained in:
@@ -406,7 +406,7 @@ impl<'a> Scope<'a> {
|
||||
self.push(name, value);
|
||||
}
|
||||
Some((index, AccessMode::ReadWrite)) => {
|
||||
let value_ref = self.values.get_mut(index).expect("valid index");
|
||||
let value_ref = self.values.get_mut(index).unwrap();
|
||||
*value_ref = Dynamic::from(value);
|
||||
}
|
||||
}
|
||||
@@ -446,7 +446,7 @@ impl<'a> Scope<'a> {
|
||||
}
|
||||
Some((_, AccessMode::ReadOnly)) => panic!("variable {} is constant", name.as_ref()),
|
||||
Some((index, AccessMode::ReadWrite)) => {
|
||||
let value_ref = self.values.get_mut(index).expect("valid index");
|
||||
let value_ref = self.values.get_mut(index).unwrap();
|
||||
*value_ref = Dynamic::from(value);
|
||||
}
|
||||
}
|
||||
@@ -492,7 +492,7 @@ impl<'a> Scope<'a> {
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub(crate) fn get_mut_by_index(&mut self, index: usize) -> &mut Dynamic {
|
||||
self.values.get_mut(index).expect("valid index")
|
||||
self.values.get_mut(index).unwrap()
|
||||
}
|
||||
/// Add an alias to an entry in the [`Scope`].
|
||||
///
|
||||
@@ -502,7 +502,7 @@ impl<'a> Scope<'a> {
|
||||
#[cfg(not(feature = "no_module"))]
|
||||
#[inline]
|
||||
pub(crate) fn add_entry_alias(&mut self, index: usize, alias: Identifier) -> &mut Self {
|
||||
let (_, aliases) = self.names.get_mut(index).expect("valid index");
|
||||
let (_, aliases) = self.names.get_mut(index).unwrap();
|
||||
match aliases {
|
||||
None => {
|
||||
let mut list = StaticVec::new_const();
|
||||
|
Reference in New Issue
Block a user