Reduce usage of Default::default() to make it easier to refactor.
This commit is contained in:
@@ -27,7 +27,7 @@ where
|
||||
if r == from {
|
||||
return Err(EvalAltResult::ErrorInFunctionCall(
|
||||
"range".to_string(),
|
||||
Default::default(),
|
||||
String::new(),
|
||||
EvalAltResult::ErrorArithmetic(
|
||||
"step value cannot be zero".to_string(),
|
||||
crate::Position::NONE,
|
||||
@@ -201,7 +201,7 @@ struct CharsStream(Vec<char>, usize);
|
||||
impl CharsStream {
|
||||
pub fn new(string: &str, from: INT, len: INT) -> Self {
|
||||
if len <= 0 {
|
||||
return Self(Default::default(), 0);
|
||||
return Self(Vec::new(), 0);
|
||||
}
|
||||
if from >= 0 {
|
||||
return Self(
|
||||
|
@@ -60,8 +60,8 @@ mod print_debug_functions {
|
||||
ctx.engine().map_type_name(&format!("{:?}", item)).into()
|
||||
}
|
||||
#[rhai_fn(name = "print", name = "debug")]
|
||||
pub fn print_empty_string() -> ImmutableString {
|
||||
Default::default()
|
||||
pub fn print_empty_string(ctx: NativeCallContext) -> ImmutableString {
|
||||
ctx.engine().const_empty_string()
|
||||
}
|
||||
#[rhai_fn(name = "print", name = "to_string")]
|
||||
pub fn print_string(s: ImmutableString) -> ImmutableString {
|
||||
|
Reference in New Issue
Block a user