Satisfy msrv by removing then_some.
This commit is contained in:
parent
c58b52f2cb
commit
14e205cabc
@ -140,7 +140,7 @@ impl Engine {
|
||||
auto_restore! { let orig_level = global.level; global.level += 1 }
|
||||
|
||||
let context = need_context
|
||||
.then_some((self, op_x_str, global.source(), &*global, pos).into());
|
||||
.then(|| (self, op_x_str, global.source(), &*global, pos).into());
|
||||
return func(context, args).map(|_| ());
|
||||
}
|
||||
}
|
||||
|
@ -400,7 +400,7 @@ impl Engine {
|
||||
|
||||
let context = func
|
||||
.has_context()
|
||||
.then_some((self, name, src, &*global, pos).into());
|
||||
.then(|| (self, name, src, &*global, pos).into());
|
||||
|
||||
let mut _result = if let Some(f) = func.get_plugin_fn() {
|
||||
if !f.is_pure() && !args.is_empty() && args[0].is_read_only() {
|
||||
@ -1460,7 +1460,7 @@ impl Engine {
|
||||
let f = f.get_plugin_fn().expect("plugin function");
|
||||
let context = f
|
||||
.has_context()
|
||||
.then_some((self, fn_name, module.id(), &*global, pos).into());
|
||||
.then(|| (self, fn_name, module.id(), &*global, pos).into());
|
||||
if !f.is_pure() && !args.is_empty() && args[0].is_read_only() {
|
||||
Err(ERR::ErrorNonPureMethodCallOnConstant(fn_name.to_string(), pos).into())
|
||||
} else {
|
||||
@ -1473,7 +1473,7 @@ impl Engine {
|
||||
let func = f.get_native_fn().expect("native function");
|
||||
let context = f
|
||||
.has_context()
|
||||
.then_some((self, fn_name, module.id(), &*global, pos).into());
|
||||
.then(|| (self, fn_name, module.id(), &*global, pos).into());
|
||||
func(context, args).and_then(|r| self.check_data_size(r, pos))
|
||||
}
|
||||
|
||||
@ -1600,7 +1600,7 @@ impl Engine {
|
||||
auto_restore! { let orig_level = global.level; global.level += 1 }
|
||||
|
||||
let context =
|
||||
need_context.then_some((self, name.as_str(), None, &*global, pos).into());
|
||||
need_context.then(|| (self, name.as_str(), None, &*global, pos).into());
|
||||
return func(context, operands);
|
||||
}
|
||||
|
||||
|
@ -1137,7 +1137,7 @@ fn optimize_expr(expr: &mut Expr, state: &mut OptimizerState, _chaining: bool) {
|
||||
_ if x.args.len() == 2 && x.op_token.is_some() && (state.engine.fast_operators() || !state.engine.has_native_fn_override(x.hashes.native(), &arg_types)) => {
|
||||
if let Some(result) = get_builtin_binary_op_fn(x.op_token.as_ref().unwrap(), &arg_values[0], &arg_values[1])
|
||||
.and_then(|(f, ctx)| {
|
||||
let context = ctx.then_some((state.engine, x.name.as_str(), None, &state.global, *pos).into());
|
||||
let context = ctx.then(|| (state.engine, x.name.as_str(), None, &state.global, *pos).into());
|
||||
let (first, second) = arg_values.split_first_mut().unwrap();
|
||||
(f)(context, &mut [ first, &mut second[0] ]).ok()
|
||||
}) {
|
||||
|
@ -2354,7 +2354,7 @@ impl Engine {
|
||||
let op = op_token.to_string();
|
||||
let hash = calc_fn_hash(None, &op, 2);
|
||||
let native_only = !is_valid_function_name(&op);
|
||||
let operator_token = native_only.then_some(op_token.clone());
|
||||
let operator_token = native_only.then(|| op_token.clone());
|
||||
|
||||
let mut args = FnArgsVec::new_const();
|
||||
args.push(root);
|
||||
|
@ -1229,7 +1229,7 @@ fn get_next_token_inner(
|
||||
// Still inside a comment?
|
||||
if state.comment_level > 0 {
|
||||
let start_pos = *pos;
|
||||
let mut comment = state.include_comments.then_some(String::new());
|
||||
let mut comment = state.include_comments.then(|| String::new());
|
||||
|
||||
state.comment_level =
|
||||
scan_block_comment(stream, state.comment_level, pos, comment.as_mut());
|
||||
|
Loading…
Reference in New Issue
Block a user