Reducce panic messages.

This commit is contained in:
Stephen Chung
2021-11-13 12:23:35 +08:00
parent c8aab47f50
commit 38884ede46
16 changed files with 161 additions and 248 deletions

View File

@@ -175,7 +175,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("at least one character");
let ch = stream.next().expect("not empty");
if stream.next().is_some() {
character
} else {
@@ -189,9 +189,7 @@ mod string_functions {
#[rhai_fn(name = "to_lower")]
pub fn to_lower_char(character: char) -> char {
let mut stream = character.to_lowercase();
let ch = stream
.next()
.expect("there should be at least one character");
let ch = stream.next().expect("not empty");
if stream.next().is_some() {
character
} else {