From 936960ee3af461cc6fd4890a6c5adc32cca9a2ad Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Tue, 22 Jun 2021 10:38:12 +0200 Subject: [PATCH] Change lints to nightly and include benches. --- .github/workflows/ci.yml | 4 ++-- benches/benchs.rs | 8 ++++---- src/operator/mod.rs | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 117d43e..552d4e8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: diff --git a/benches/benchs.rs b/benches/benchs.rs index beb32c3..a1d29c4 100644 --- a/benches/benchs.rs +++ b/benches/benchs.rs @@ -54,9 +54,9 @@ fn generate_small_expressions(len: usize, gen: &mut Gen) -> Vec(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(|| { diff --git a/src/operator/mod.rs b/src/operator/mod.rs index 95c64e4..0ae3794 100644 --- a/src/operator/mod.rs +++ b/src/operator/mod.rs @@ -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(