Change expect("exists") to unwrap().
This commit is contained in:
@@ -300,7 +300,7 @@ impl EvalAltResult {
|
||||
format!("{:?}", self)
|
||||
.split('(')
|
||||
.next()
|
||||
.expect("debug format of error is `ErrorXXX(...)`")
|
||||
.expect("`ErrorXXX(...)`")
|
||||
.into(),
|
||||
);
|
||||
|
||||
|
@@ -60,7 +60,7 @@ impl StringsInterner {
|
||||
};
|
||||
|
||||
if dict.contains_key(text.as_ref()) {
|
||||
dict.get(text.as_ref()).expect("exists").clone()
|
||||
dict.get(text.as_ref()).unwrap().clone()
|
||||
} else {
|
||||
let value: ImmutableString = mapper(text.as_ref()).into();
|
||||
dict.insert(text.as_ref().into(), value.clone());
|
||||
|
@@ -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