Skip to content

Major performance improvement achieved through fixing clippy warnings #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ jobs:
- name: "Generate Cargo Lockfile"
run: "cargo generate-lockfile"

- name: "Run clippy"
shell: bash
run: "cargo clippy --all --tests -- -D warnings"

# Cache build dependencies
- name: "Cache Build Fragments"
id: "cache-build-fragments"
Expand Down
14 changes: 12 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ required-features = ["cmdline"]
cmdline = ["anyhow", "clap"]
default = []
python = ["cpython"]
wasm = ["wasm-bindgen"]
wasm = ["wasm-bindgen", "gloo-utils"]

[dependencies]
phf = {version = "~0.8.0", features = ["macros"]}
phf = { version = "~0.8.0", features = ["macros"] }
serde_json = "~1.0.41"
thiserror = "~1.0.11"

Expand All @@ -39,6 +39,16 @@ features = ["serde-serialize"]
optional = true
version = "~0.2.62"

[dependencies.gloo-utils]
features = []
optional = true
version = "~0.2.0"


[dependencies.serde]
features = ["derive"]
version = "1"

[dependencies.cpython]
features = ["extension-module"]
optional = true
Expand Down
5 changes: 1 addition & 4 deletions src/bin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ use std::io::Read;

use anyhow::{Context, Result};
use clap::{App, Arg};
use serde_json;
use serde_json::Value;

use jsonlogic_rs;

fn configure_args<'a, 'b>(app: App<'a, 'b>) -> App<'a, 'b> {
app.version(env!("CARGO_PKG_VERSION"))
.author("Matthew Planchard <[email protected]>")
Expand Down Expand Up @@ -67,7 +64,7 @@ fn main() -> Result<()> {
let result = jsonlogic_rs::apply(&json_logic, &json_data)
.context("Could not execute logic")?;

println!("{}", result.to_string());
println!("{}", result);

Ok(())
}
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! Error handling
//!
use serde_json::Value;
use thiserror;

use crate::op::NumParams;

Expand Down Expand Up @@ -30,6 +29,7 @@ pub enum Error {
#[error("Invalid variable mapping - {0} is not an object.")]
InvalidVarMap(Value),

#[allow(clippy::enum_variant_names)]
#[error("Encountered an unexpected error. Please raise an issue on GitHub and include the following error message: {0}")]
UnexpectedError(String),

Expand Down
Loading