Skip to content

Commit

Permalink
Silence some spurious clippy warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpschorr committed Jan 15, 2025
1 parent 3647c56 commit af8d13f
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 4 deletions.
12 changes: 12 additions & 0 deletions partiql-conformance-test-generator/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ pub mod spec {
}

#[derive(Debug, Clone)]
// Assertions model the partiql-tests DSL; there are some spurious warnings before code generation.
#[allow(dead_code)]
pub enum Assertion {
SyntaxSuccess(SyntaxSuccessAssertion),
SyntaxFail(SyntaxFailAssertion),
Expand Down Expand Up @@ -138,28 +140,38 @@ pub mod spec {
}

#[derive(Debug, Clone)]
// Assertions model the partiql-tests DSL; there are some spurious warnings before code generation.
#[allow(dead_code)]
pub struct SyntaxSuccessAssertion {
pub result: String,
}

#[derive(Debug, Clone)]
// Assertions model the partiql-tests DSL; there are some spurious warnings before code generation.
#[allow(dead_code)]
pub struct SyntaxFailAssertion {
pub result: String,
}

#[derive(Debug, Clone)]
// Assertions model the partiql-tests DSL; there are some spurious warnings before code generation.
#[allow(dead_code)]
pub struct StaticAnalysisFailAssertion {
pub result: String,
}

#[derive(Debug, Clone)]
// Assertions model the partiql-tests DSL; there are some spurious warnings before code generation.
#[allow(dead_code)]
pub struct EvaluationSuccessAssertion {
pub result: String,
pub output: Element,
pub eval_mode: EvaluationModeList,
}

#[derive(Debug, Clone)]
// Assertions model the partiql-tests DSL; there are some spurious warnings before code generation.
#[allow(dead_code)]
pub struct EvaluationFailAssertion {
pub result: String,
pub eval_mode: EvaluationModeList,
Expand Down
4 changes: 3 additions & 1 deletion partiql-conformance-tests/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ fn main() -> miette::Result<()> {
.arg("fmt")
.arg("--")
.spawn()
.expect("cargo fmt of tests/ failed");
.expect("cargo fmt of tests/ failed")
.wait()
.expect("cargo fmt of tests/ failed to exit");

Ok(())
}
12 changes: 12 additions & 0 deletions partiql-eval/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,21 @@ regex-syntax = "0.8"
rustc-hash = "2"
delegate = "0.13"

serde = { version = "1", features = ["derive"], optional = true }

[dev-dependencies]
criterion = "0.5"


[features]
default = []
serde = [
"dep:serde",
"rust_decimal/serde-with-str",
"partiql-logical/serde",
"partiql-value/serde",
]

[[bench]]
name = "bench_eval"
harness = false
3 changes: 3 additions & 0 deletions partiql-eval/src/eval/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ use unicase::UniCase;
use crate::eval::evaluable::{EvalType, Evaluable};
use crate::plan::EvaluationMode;

#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};

pub(crate) mod eval_expr_wrapper;
pub mod evaluable;
pub mod expr;
Expand Down
3 changes: 0 additions & 3 deletions partiql-value/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ pub use sort::*;
pub use tuple::*;
pub use value::*;

#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};

#[cfg(test)]
mod tests {
use super::*;
Expand Down
6 changes: 6 additions & 0 deletions partiql/tests/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,14 @@ impl From<Box<dyn Error>> for TestError<'_> {
}
}

#[allow(dead_code)]
#[track_caller]
#[inline]
pub fn parse(statement: &str) -> ParserResult<'_> {
partiql_parser::Parser::default().parse(statement)
}

#[allow(dead_code)]
#[track_caller]
#[inline]
pub fn lower(
Expand All @@ -72,6 +74,7 @@ pub fn lower(
planner.lower(parsed)
}

#[allow(dead_code)]
#[track_caller]
#[inline]
pub fn compile(
Expand All @@ -83,6 +86,7 @@ pub fn compile(
planner.compile(&logical)
}

#[allow(dead_code)]
#[track_caller]
#[inline]
pub fn evaluate(mut plan: EvalPlan, bindings: MapBindings<Value>) -> EvalResult {
Expand All @@ -93,6 +97,7 @@ pub fn evaluate(mut plan: EvalPlan, bindings: MapBindings<Value>) -> EvalResult
plan.execute_mut(&ctx)
}

#[allow(dead_code)]
#[track_caller]
#[inline]
pub fn eval_query_with_catalog<'a>(
Expand All @@ -107,6 +112,7 @@ pub fn eval_query_with_catalog<'a>(
Ok(evaluate(plan, bindings)?)
}

#[allow(dead_code)]
#[track_caller]
#[inline]
pub fn eval_query(statement: &str, mode: EvaluationMode) -> Result<Evaluated, TestError<'_>> {
Expand Down
1 change: 1 addition & 0 deletions partiql/tests/comparisons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ pub fn eval_op(op: &str) {
fn op_values() -> [Value; 4] {
[
Value::Integer(1),
#[allow(clippy::approx_constant)]
Value::Real(3.14.into()),
Value::Boolean(true),
Value::String("foo".to_string().into()),
Expand Down
2 changes: 2 additions & 0 deletions partiql/tests/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ fn pretty_val() {
tuple!(("n", 9)),
tuple!(("n", 10))
);

#[allow(clippy::approx_constant)]
let t_val = tuple!(
("foo", true),
("-foo", false),
Expand Down

0 comments on commit af8d13f

Please sign in to comment.