mirror of
https://github.com/fluencelabs/jsonpath
synced 2025-04-24 17:02:16 +00:00
apply clippy lints - wasm, nodejs
This commit is contained in:
parent
319186b1d9
commit
9a28faf058
@ -29,6 +29,8 @@ matrix:
|
||||
- cargo build --verbose --all
|
||||
- cargo clippy --all-targets --all-features -- -D warnings -A clippy::cognitive_complexity
|
||||
- cargo test --verbose --all
|
||||
- cd wasm && cargo clippy -- -D warnings -A clippy::suspicious_else_formatting
|
||||
- cd ../nodejs/native && cargo clippy -- -D warnings
|
||||
after_success: |
|
||||
cargo tarpaulin --exclude-files nodejs wasm parser/mod.rs --out Xml
|
||||
bash <(curl -s https://codecov.io/bash)
|
||||
|
13
build.sh
13
build.sh
@ -2,9 +2,6 @@
|
||||
|
||||
set -e
|
||||
|
||||
cargo clippy -- -D warnings && \
|
||||
cargo clippy --all-targets --all-features -- -D warnings -A clippy::cognitive_complexity
|
||||
|
||||
# project_root
|
||||
DIR="$(pwd)"
|
||||
WASM="${DIR}"/wasm
|
||||
@ -31,6 +28,16 @@ __cargo_clean () {
|
||||
cd "${DIR}" && cargo clean
|
||||
}
|
||||
|
||||
if [ "$1" = "clippy" ]
|
||||
then
|
||||
echo
|
||||
__msg "clippy"
|
||||
cargo clippy -- -D warnings && \
|
||||
cargo clippy --all-targets --all-features -- -D warnings -A clippy::cognitive_complexity && \
|
||||
cd "${WASM}" && cargo clippy -- -A clippy::suspicious_else_formatting && \
|
||||
cd "${NODEJS}" && cargo clippy
|
||||
fi
|
||||
|
||||
echo
|
||||
__msg "clean"
|
||||
rm -rf \
|
||||
|
@ -206,7 +206,7 @@ declare_types! {
|
||||
{
|
||||
let guard = ctx.lock();
|
||||
let mut this = this.borrow_mut(&guard);
|
||||
let _ = this.path(&path);
|
||||
this.path(&path);
|
||||
}
|
||||
|
||||
Ok(JsUndefined::new().upcast())
|
||||
@ -219,7 +219,7 @@ declare_types! {
|
||||
{
|
||||
let guard = ctx.lock();
|
||||
let mut this = this.borrow_mut(&guard);
|
||||
let _ = this.value(&json_str);
|
||||
this.value(&json_str);
|
||||
}
|
||||
|
||||
Ok(JsUndefined::new().upcast())
|
||||
|
@ -132,6 +132,7 @@ extern crate serde_json;
|
||||
|
||||
use serde_json::Value;
|
||||
|
||||
pub use parser::Parser;
|
||||
pub use select::JsonPathError;
|
||||
pub use select::{Selector, SelectorMut};
|
||||
|
||||
|
@ -102,7 +102,7 @@ pub fn compile(path: &str) -> JsValue {
|
||||
},
|
||||
Err(e) => JsValue::from_str(&format!("{:?}", e)),
|
||||
}
|
||||
}) as Box<Fn(JsValue) -> JsValue>);
|
||||
}) as Box<dyn Fn(JsValue) -> JsValue>);
|
||||
|
||||
let ret = cb.as_ref().clone();
|
||||
cb.forget();
|
||||
@ -131,8 +131,8 @@ pub fn selector(js_value: JsValue) -> JsValue {
|
||||
Err(e) => JsValue::from_str(&format!("{:?}", e)),
|
||||
}
|
||||
}
|
||||
Err(e) => return JsValue::from_str(&format!("{:?}", JsonPathError::Path(e))),
|
||||
}) as Box<Fn(String) -> JsValue>,
|
||||
Err(e) => JsValue::from_str(&format!("{:?}", JsonPathError::Path(e))),
|
||||
}) as Box<dyn Fn(String) -> JsValue>,
|
||||
);
|
||||
|
||||
let ret = cb.as_ref().clone();
|
||||
@ -193,6 +193,7 @@ pub fn replace_with(js_value: JsValue, path: &str, fun: js_sys::Function) -> JsV
|
||||
/// lifetime 제약으로 Selector를 사용 할 수 없다.
|
||||
///
|
||||
#[wasm_bindgen]
|
||||
#[derive(Default)]
|
||||
pub struct Selector {
|
||||
path: Option<String>,
|
||||
value: Option<Value>,
|
||||
@ -202,10 +203,7 @@ pub struct Selector {
|
||||
impl Selector {
|
||||
#[wasm_bindgen(constructor)]
|
||||
pub fn new() -> Self {
|
||||
Selector {
|
||||
path: None,
|
||||
value: None,
|
||||
}
|
||||
Selector::default()
|
||||
}
|
||||
|
||||
#[wasm_bindgen(catch)]
|
||||
@ -263,6 +261,7 @@ impl Selector {
|
||||
/// `wasm_bindgen` 제약으로 builder-pattern을 구사 할 수 없다.
|
||||
///
|
||||
#[wasm_bindgen]
|
||||
#[derive(Default)]
|
||||
pub struct SelectorMut {
|
||||
path: Option<String>,
|
||||
value: Option<Value>,
|
||||
@ -272,10 +271,7 @@ pub struct SelectorMut {
|
||||
impl SelectorMut {
|
||||
#[wasm_bindgen(constructor)]
|
||||
pub fn new() -> Self {
|
||||
SelectorMut {
|
||||
path: None,
|
||||
value: None,
|
||||
}
|
||||
SelectorMut::default()
|
||||
}
|
||||
|
||||
#[wasm_bindgen(catch)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user