Fix warnings.

This commit is contained in:
Stephen Chung
2022-06-08 17:06:49 +08:00
parent bbaad8dfcb
commit e5f6b28abd
7 changed files with 29 additions and 24 deletions

View File

@@ -550,11 +550,12 @@ impl Engine {
level: usize,
new_val: Option<(Dynamic, OpAssignment)>,
) -> RhaiResult {
let (crate::ast::BinaryExpr { lhs, rhs }, chain_type, options, op_pos) = match expr {
let chain_type = ChainType::from(expr);
let (crate::ast::BinaryExpr { lhs, rhs }, options, op_pos) = match expr {
#[cfg(not(feature = "no_index"))]
Expr::Index(x, options, pos) => (x.as_ref(), ChainType::Indexing, *options, *pos),
Expr::Index(x, options, pos) => (x.as_ref(), *options, *pos),
#[cfg(not(feature = "no_object"))]
Expr::Dot(x, options, pos) => (x.as_ref(), ChainType::Dotting, *options, *pos),
Expr::Dot(x, options, pos) => (x.as_ref(), *options, *pos),
expr => unreachable!("Expr::Index or Expr::Dot expected but gets {:?}", expr),
};
@@ -677,7 +678,7 @@ impl Engine {
{
let crate::ast::BinaryExpr { lhs, rhs, .. } = x.as_ref();
let mut arg_values = FnArgsVec::new();
let mut _arg_values = FnArgsVec::new_const();
// Evaluate in left-to-right order
match lhs {
@@ -690,7 +691,7 @@ impl Engine {
if _parent_chain_type == ChainType::Dotting && !x.is_qualified() =>
{
for arg_expr in x.args.as_ref() {
arg_values.push(
_arg_values.push(
self.get_arg_value(
scope, global, caches, lib, this_ptr, arg_expr, level,
)?
@@ -709,7 +710,7 @@ impl Engine {
}
#[cfg(not(feature = "no_index"))]
_ if _parent_chain_type == ChainType::Indexing => {
arg_values.push(
_arg_values.push(
self.eval_expr(scope, global, caches, lib, this_ptr, lhs, level)?
.flatten(),
);
@@ -725,7 +726,9 @@ impl Engine {
size, level,
)?;
idx_values.extend(arg_values);
if !_arg_values.is_empty() {
idx_values.extend(_arg_values);
}
}
#[cfg(not(feature = "no_object"))]

View File

@@ -273,7 +273,7 @@ impl<'a> Target<'a> {
/// Propagate a changed value back to the original source.
/// This has no effect for direct references.
#[inline]
pub fn propagate_changed_value(&mut self, pos: Position) -> RhaiResultOf<()> {
pub fn propagate_changed_value(&mut self, _pos: Position) -> RhaiResultOf<()> {
match self {
Self::RefMut(..) | Self::TempValue(..) => (),
#[cfg(not(feature = "no_closure"))]
@@ -285,7 +285,7 @@ impl<'a> Target<'a> {
Box::new(crate::ERR::ErrorMismatchDataType(
"bool".to_string(),
err.to_string(),
pos,
_pos,
))
})?;
@@ -315,7 +315,7 @@ impl<'a> Target<'a> {
Box::new(crate::ERR::ErrorMismatchDataType(
"integer".to_string(),
err.to_string(),
pos,
_pos,
))
})?;
@@ -336,7 +336,7 @@ impl<'a> Target<'a> {
Box::new(crate::ERR::ErrorMismatchDataType(
"INT".to_string(),
err.to_string(),
pos,
_pos,
))
})?;
@@ -361,7 +361,7 @@ impl<'a> Target<'a> {
Box::new(crate::ERR::ErrorMismatchDataType(
"char".to_string(),
err.to_string(),
pos,
_pos,
))
})?;