Change lints to nightly and include benches.

This commit is contained in:
Sebastian Schmidt 2021-06-22 10:38:12 +02:00
parent 55a02aec78
commit 936960ee3a
3 changed files with 9 additions and 9 deletions

View File

@ -27,11 +27,11 @@ jobs:
command: fmt
args: --all -- --check
components: rustfmt
- toolchain: stable
- toolchain: nightly
command:
name: Lint
command: clippy
args: --all-features
args: --all-features --tests --benches
components: clippy
steps:

View File

@ -54,9 +54,9 @@ fn generate_small_expressions<Gen: Rng>(len: usize, gen: &mut Gen) -> Vec<String
fn generate_large_tuple_expression<Gen: Rng>(iterations: usize, gen: &mut Gen) -> String {
let mut result = String::from("a=(");
result.push_str(&generate_expression(0, gen));
result.push_str(",");
result.push(',');
result.push_str(&generate_expression(0, gen));
result.push_str(")");
result.push(')');
for _ in 0..iterations {
result.push_str(";a=(a,a)")
}
@ -86,7 +86,7 @@ fn bench_parse_many_small_expressions(bencher: &mut Bencher) {
bencher.iter(|| {
for expression in &small_expressions {
black_box(build_operator_tree(&expression).unwrap());
black_box(build_operator_tree(expression).unwrap());
}
});
}
@ -114,7 +114,7 @@ fn bench_evaluate_many_small_expressions(bencher: &mut Bencher) {
let mut gen = Pcg32::seed_from_u64(33);
let small_expressions: Vec<_> = generate_small_expressions(BENCHMARK_LEN, &mut gen)
.iter()
.map(|expression| build_operator_tree(&expression).unwrap())
.map(|expression| build_operator_tree(expression).unwrap())
.collect();
bencher.iter(|| {

View File

@ -429,7 +429,7 @@ impl Operator {
VariableIdentifier { identifier } => {
expect_operator_argument_amount(arguments.len(), 0)?;
if let Some(value) = context.get_value(&identifier).cloned() {
if let Some(value) = context.get_value(identifier).cloned() {
Ok(value)
} else {
Err(EvalexprError::VariableIdentifierNotFound(
@ -441,9 +441,9 @@ impl Operator {
expect_operator_argument_amount(arguments.len(), 1)?;
let arguments = &arguments[0];
match context.call_function(&identifier, arguments) {
match context.call_function(identifier, arguments) {
Err(EvalexprError::FunctionIdentifierNotFound(_)) => {
if let Some(builtin_function) = builtin_function(&identifier) {
if let Some(builtin_function) = builtin_function(identifier) {
builtin_function.call(arguments)
} else {
Err(EvalexprError::FunctionIdentifierNotFound(