Refine expect messages.
This commit is contained in:
@@ -45,7 +45,7 @@ fn collect_fn_metadata(ctx: NativeCallContext) -> crate::Array {
|
||||
namespace: Option<Identifier>,
|
||||
f: &ScriptFnDef,
|
||||
) -> Map {
|
||||
const DICT: &str = "never fails because the dictionary is pre-filled with all the keys";
|
||||
const DICT: &str = "key exists";
|
||||
|
||||
let mut map = Map::new();
|
||||
|
||||
|
@@ -31,7 +31,7 @@ pub fn print_with_func(
|
||||
match ctx.call_fn_dynamic_raw(fn_name, true, &mut [value]) {
|
||||
Ok(result) if result.is::<crate::ImmutableString>() => result
|
||||
.into_immutable_string()
|
||||
.expect("never fails as the result is `ImmutableString`"),
|
||||
.expect("result is `ImmutableString`"),
|
||||
Ok(result) => ctx.engine().map_type_name(result.type_name()).into(),
|
||||
Err(_) => ctx.engine().map_type_name(value.type_name()).into(),
|
||||
}
|
||||
|
@@ -116,9 +116,7 @@ mod string_functions {
|
||||
#[rhai_fn(name = "to_upper")]
|
||||
pub fn to_upper_char(character: char) -> char {
|
||||
let mut stream = character.to_uppercase();
|
||||
let ch = stream
|
||||
.next()
|
||||
.expect("never fails because there should be at least one character");
|
||||
let ch = stream.next().expect("at least one character");
|
||||
if stream.next().is_some() {
|
||||
character
|
||||
} else {
|
||||
@@ -134,7 +132,7 @@ mod string_functions {
|
||||
let mut stream = character.to_lowercase();
|
||||
let ch = stream
|
||||
.next()
|
||||
.expect("never fails because there should be at least one character");
|
||||
.expect("there should be at least one character");
|
||||
if stream.next().is_some() {
|
||||
character
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user