diff --git a/src/fn_call.rs b/src/fn_call.rs index 6bd95393..162410f3 100644 --- a/src/fn_call.rs +++ b/src/fn_call.rs @@ -930,8 +930,8 @@ pub fn run_builtin_binary_op( } if args_type == TypeId::of::() { - let x = *x.downcast_ref::().unwrap(); - let y = *y.downcast_ref::().unwrap(); + let x = x.clone().cast::(); + let y = y.clone().cast::(); #[cfg(not(feature = "unchecked"))] match op { @@ -972,8 +972,8 @@ pub fn run_builtin_binary_op( _ => (), } } else if args_type == TypeId::of::() { - let x = *x.downcast_ref::().unwrap(); - let y = *y.downcast_ref::().unwrap(); + let x = x.clone().cast::(); + let y = y.clone().cast::(); match op { "&" => return Ok(Some((x && y).into())), @@ -998,8 +998,8 @@ pub fn run_builtin_binary_op( _ => (), } } else if args_type == TypeId::of::() { - let x = *x.downcast_ref::().unwrap(); - let y = *y.downcast_ref::().unwrap(); + let x = x.clone().cast::(); + let y = y.clone().cast::(); match op { "==" => return Ok(Some((x == y).into())), @@ -1020,8 +1020,8 @@ pub fn run_builtin_binary_op( #[cfg(not(feature = "no_float"))] if args_type == TypeId::of::() { - let x = *x.downcast_ref::().unwrap(); - let y = *y.downcast_ref::().unwrap(); + let x = x.clone().cast::(); + let y = y.clone().cast::(); match op { "+" => return Ok(Some((x + y).into())), @@ -1059,7 +1059,7 @@ pub fn run_builtin_op_assignment( if args_type == TypeId::of::() { let x = x.downcast_mut::().unwrap(); - let y = *y.downcast_ref::().unwrap(); + let y = y.clone().cast::(); #[cfg(not(feature = "unchecked"))] match op { @@ -1095,7 +1095,7 @@ pub fn run_builtin_op_assignment( } } else if args_type == TypeId::of::() { let x = x.downcast_mut::().unwrap(); - let y = *y.downcast_ref::().unwrap(); + let y = y.clone().cast::(); match op { "&=" => return Ok(Some(*x = *x && y)), @@ -1115,7 +1115,7 @@ pub fn run_builtin_op_assignment( #[cfg(not(feature = "no_float"))] if args_type == TypeId::of::() { let x = x.downcast_mut::().unwrap(); - let y = *y.downcast_ref::().unwrap(); + let y = y.clone().cast::(); match op { "+=" => return Ok(Some(*x += y)), diff --git a/src/packages/string_more.rs b/src/packages/string_more.rs index 62a5fdb2..6ddc2b0c 100644 --- a/src/packages/string_more.rs +++ b/src/packages/string_more.rs @@ -15,7 +15,7 @@ use crate::stdlib::{ any::TypeId, boxed::Box, fmt::Display, - format, + format, mem, string::{String, ToString}, vec::Vec, }; @@ -242,7 +242,7 @@ def_package!(crate:MoreStringPackage:"Additional string utilities, including str } if len > 0 { - let ch = *args[2].downcast_ref::< char>().unwrap(); + let ch = mem::take(args[2]).cast::(); let s = args[0].downcast_mut::().unwrap(); let orig_len = s.chars().count();