Skip to content

Commit

Permalink
feat: add some additional denies and warns
Browse files Browse the repository at this point in the history
  • Loading branch information
gadomski committed Oct 9, 2024
1 parent 50c4a8f commit b6c1f8d
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@ pub enum Error {
/// Invalid number of arguments for the expression
#[error("invalid number of arguments for {name}: {actual} (expected {expected})")]
InvalidNumberOfArguments {
/// The name of the expression or operation
name: String,

/// The actual number of arguments
actual: usize,

/// The number of arguments the expression or operation expected
expected: usize,
},

Expand Down
1 change: 1 addition & 0 deletions src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use std::str::FromStr;
/// and use [Expr::is_valid] to check validity.
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(untagged)]
#[allow(missing_docs)]
pub enum Expr {
Operation { op: String, args: Vec<Box<Expr>> },
Interval { interval: Vec<Box<Expr>> },
Expand Down
29 changes: 28 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
//! Parse and transform [Common Query Language 2 (CQL2)](https://docs.ogc.org/is/21-065r2/21-065r2.html).
#![deny(unused_crate_dependencies)]
#![warn(missing_docs)]
#![deny(
elided_lifetimes_in_paths,
explicit_outlives_requirements,
keyword_idents,
macro_use_extern_crate,
meta_variable_misuse,
missing_abi,
missing_debug_implementations,
non_ascii_idents,
noop_method_call,
rust_2021_incompatible_closure_captures,
rust_2021_incompatible_or_patterns,
rust_2021_prefixes_incompatible_syntax,
rust_2021_prelude_collisions,
single_use_lifetimes,
trivial_casts,
trivial_numeric_casts,
unreachable_pub,
unsafe_code,
unsafe_op_in_unsafe_fn,
unused_crate_dependencies,
unused_extern_crates,
unused_import_braces,
unused_lifetimes,
unused_qualifications,
unused_results
)]

mod error;
mod expr;
Expand Down
4 changes: 2 additions & 2 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ fn strip_quotes(s: &str) -> &str {
}
}

fn opstr(op: Pair<Rule>) -> String {
fn opstr(op: Pair<'_, Rule>) -> String {
return normalize_op(op.as_str());
}

Expand Down Expand Up @@ -316,6 +316,6 @@ mod tests {

#[test]
fn point_zm() {
CQL2Parser::parse(Rule::GEOMETRY, "POINT ZM(-105.1019 40.1672 4981 42)").unwrap();
let _ = CQL2Parser::parse(Rule::GEOMETRY, "POINT ZM(-105.1019 40.1672 4981 42)").unwrap();
}
}
1 change: 1 addition & 0 deletions src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use boon::{Compiler, SchemaIndex, Schemas, ValidationError};
use serde_json::Value;

/// A re-usable json-schema validator for CQL2.
#[allow(missing_debug_implementations)]
pub struct Validator {
schemas: Schemas,
index: SchemaIndex,
Expand Down

0 comments on commit b6c1f8d

Please sign in to comment.