Skip to content
Draft
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
24 changes: 23 additions & 1 deletion .github/workflows/rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,28 @@ jobs:
with:
command: test

test-wasm:
name: Test WebAssembly (WASI)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: wasm32-wasi
override: true
- uses: actions-rs/cargo@v1
with:
command: install
args: wasmtime-cli cargo-wasi
- uses: actions-rs/cargo@v1
env:
CARGO_TARGET_WASM32_WASI_RUNNER: "wasmtime --dir=."
with:
command: wasi
args: test -- --nocapture

clippy:
name: Clippy
runs-on: ubuntu-latest
Expand All @@ -45,7 +67,7 @@ jobs:
profile: minimal
toolchain: stable
override: true
- run: rustup component add clippy
components: clippy
- uses: actions-rs/cargo@v1
with:
command: clippy
Expand Down
9 changes: 5 additions & 4 deletions src/evaluator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,11 @@ impl<'a> Evaluator<'a> {
}

let result = Value::object(self.arena);
for (key, value) in (&tuple_stream[0]).entries() {
for (key, value) in tuple_stream[0].entries() {
result.insert(key, value);
}
for i in 1..tuple_stream.len() {
for (key, value) in (&tuple_stream[i]).entries() {
for (key, value) in tuple_stream[i].entries() {
let args = Value::array_with_capacity(self.arena, 2, ArrayFlags::empty());
args.push(result.get_entry(&key[..]));
args.push(value);
Expand Down Expand Up @@ -997,7 +997,7 @@ impl<'a> Evaluator<'a> {

let sorted = merge_sort(unsorted, &comp)?;
let result = Value::array_with_capacity(self.arena, sorted.len(), input.get_flags());
sorted.iter().for_each(|member| result.push(*member));
sorted.iter().for_each(|member| result.push(member));

Ok(result)
}
Expand Down Expand Up @@ -1071,7 +1071,7 @@ impl<'a> Evaluator<'a> {
match predicate.kind {
AstKind::Number(n) => {
let index = get_index(n);
let item = input.get_member(index as usize);
let item = input.get_member(index);
if !item.is_undefined() {
if item.is_array() {
return Ok(item);
Expand Down Expand Up @@ -1158,6 +1158,7 @@ impl<'a> Evaluator<'a> {
})
}

#[allow(clippy::only_used_in_recursion)]
fn recurse_descendants(
&self,
input: &'a Value<'a>,
Expand Down
Loading