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 command: fmt
args: --all -- --check args: --all -- --check
components: rustfmt components: rustfmt
- toolchain: stable - toolchain: nightly
command: command:
name: Lint name: Lint
command: clippy command: clippy
args: --all-features args: --all-features --tests --benches
components: clippy components: clippy
steps: 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 { fn generate_large_tuple_expression<Gen: Rng>(iterations: usize, gen: &mut Gen) -> String {
let mut result = String::from("a=("); let mut result = String::from("a=(");
result.push_str(&generate_expression(0, gen)); result.push_str(&generate_expression(0, gen));
result.push_str(","); result.push(',');
result.push_str(&generate_expression(0, gen)); result.push_str(&generate_expression(0, gen));
result.push_str(")"); result.push(')');
for _ in 0..iterations { for _ in 0..iterations {
result.push_str(";a=(a,a)") result.push_str(";a=(a,a)")
} }
@ -86,7 +86,7 @@ fn bench_parse_many_small_expressions(bencher: &mut Bencher) {
bencher.iter(|| { bencher.iter(|| {
for expression in &small_expressions { 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 mut gen = Pcg32::seed_from_u64(33);
let small_expressions: Vec<_> = generate_small_expressions(BENCHMARK_LEN, &mut gen) let small_expressions: Vec<_> = generate_small_expressions(BENCHMARK_LEN, &mut gen)
.iter() .iter()
.map(|expression| build_operator_tree(&expression).unwrap()) .map(|expression| build_operator_tree(expression).unwrap())
.collect(); .collect();
bencher.iter(|| { bencher.iter(|| {

View File

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