Skip to content

Commit b4c4ec8

Browse files
authored
chore: fix nightly CI
* chore(ci): fix a number of new nightly warnings * deps: updated a number of dependencies bump clap from 4.5.4 to 4.5.7 bump log from 0.4.21 to 0.4.22 bump thiserror from 1.0.58 to 1.0.61 * chore(ci): update deny.toml according to cargo-deny breaking changes See EmbarkStudios/cargo-deny#606. * chore(test): fix tests in quotes that were erroneously disabled * chore(doc): fix a bunch of documentation whitespace lints
1 parent f0256bb commit b4c4ec8

17 files changed

+344
-293
lines changed

Cargo.lock

+182-178
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/rsonpath-lib/src/automaton.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,9 @@ impl<'q> Automaton<'q> {
154154
///
155155
/// # Errors
156156
/// - [`CompilerError::QueryTooComplex`] raised if the query is too complex
157-
/// and the automaton size was exceeded.
157+
/// and the automaton size was exceeded.
158158
/// - [`CompilerError::NotSupported`] raised if the query contains elements
159-
/// not yet supported by the compiler.
159+
/// not yet supported by the compiler.
160160
#[inline]
161161
pub fn new(query: &'q JsonPathQuery) -> Result<Self, CompilerError> {
162162
let nfa = NondeterministicAutomaton::new(query)?;

crates/rsonpath-lib/src/automaton/array_transition_set.rs

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
//! * {prio. 2} over X intersect Y to S+{t}
2929
//! * {prio. 1} over X to S
3030
//! * {prio. 1} over Y to {t}
31+
//!
3132
//! The semantics are correct as long as the transitions are taken in non-increasing order of priorities.
3233
//!
3334
//! Intersection of two linear sets is always a linear set. Finding such intersection is not trivial,

crates/rsonpath-lib/src/automaton/minimizer.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,10 @@ struct SuperstateTransitionTable<'q> {
6060
* Every state with a self-loop becomes a checkpoint. They have two crucial properties:
6161
* 1. Any path from the initial to the accepting state goes through each checkpoint.
6262
* 2. Each superstate containing
63-
* a) a checkpoint and;
64-
* b) some states on the path from the initial state to that checkpoint,
65-
* is equivalent to a superstate without the b) states.
63+
* a) a checkpoint and;
64+
* b) some states on the path from the initial state to that checkpoint,
65+
* is equivalent to a superstate without the b) states.
66+
*
6667
* This allows on-the-fly minimization with the `normalize` function, vastly reducing
6768
* the number of superstates to consider.
6869
*

crates/rsonpath-lib/src/automaton/small_set.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,9 @@ macro_rules! native_small_set {
191191
};
192192
}
193193

194-
native_small_set!(SmallSet64, SmallSet64Iter, u64, 64);
194+
// If a SmallSet64 is ever needed it can be constructed with the macro.
195+
// native_small_set!(SmallSet64, SmallSet64Iter, u64, 64);
196+
// Currently we only use SmallSet256 which relies on SmallSet128.
195197
native_small_set!(SmallSet128, SmallSet128Iter, u128, 128);
196198

197199
impl<const N: usize> From<[u8; N]> for SmallSet256 {

crates/rsonpath-lib/src/classification.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
//! Classifiers working on the input stream.
22
//!
33
//! - [`quotes`] contains the low-level [`QuoteClassifiedIterator`](`quotes::QuoteClassifiedIterator`)
4-
//! computing basic information on which characters are escaped or within quotes.
4+
//! computing basic information on which characters are escaped or within quotes.
55
//! - [`structural`] contains the [`StructuralIterator`](`structural::StructuralIterator`)
6-
//! that wraps over a quote classifier to extract a stream of [`Structural`](`structural::Structural`) characters.
6+
//! that wraps over a quote classifier to extract a stream of [`Structural`](`structural::Structural`) characters.
77
//! - [`depth`] contains the [`DepthIterator`](`depth::DepthIterator`) that works on top of a quote classifier
8-
//! to provide quick fast-forwarding over the stream while keeping track of the depth.
8+
//! to provide quick fast-forwarding over the stream while keeping track of the depth.
99
//!
1010
//! This base module provides the [`ResumeClassifierState`] struct common between all
1111
//! higher-level classifiers that work on top of a [`QuoteClassifiedIterator`](`quotes::QuoteClassifiedIterator`).

crates/rsonpath-lib/src/classification/memmem.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ pub trait Memmem<'i, 'b, 'r, I: Input, const N: usize> {
1212
/// Find a member key identified by a given [`JsonString`].
1313
///
1414
/// - `first_block` &ndash; optional first block to search; if not provided,
15-
/// the search will start at the next block returned by the underlying [`Input`] iterator.
15+
/// the search will start at the next block returned by the underlying [`Input`] iterator.
1616
/// - `start_idx` &ndash; index of the start of search, either falling inside `first_block`,
17-
/// or at the start of the next block.
17+
/// or at the start of the next block.
1818
///
1919
/// # Errors
2020
/// Errors when reading the underlying [`Input`] are propagated.

crates/rsonpath-lib/src/classification/quotes/avx2_32.rs

+33-13
Original file line numberDiff line numberDiff line change
@@ -31,28 +31,48 @@ impl BlockAvx2Classifier {
3131
}
3232
}
3333

34-
#[cfg(all(test, cfg = "avx_32"))]
34+
#[cfg(test)]
3535
mod tests {
36-
use super::Avx2QuoteClassifier32;
36+
use super::{Constructor, QuotesImpl};
3737
use crate::{
3838
input::{Input, OwnedBytes},
3939
result::empty::EmptyRecorder,
4040
FallibleIterator,
4141
};
4242
use test_case::test_case;
4343

44-
#[test_case("" => None)]
45-
#[test_case("abcd" => Some(0))]
46-
#[test_case(r#""abcd""# => Some(0b01_1111))]
47-
#[test_case(r#""num": 42, "string": "something" "# => Some(0b0_0111_1111_1110_0011_1111_1000_0000_1111))]
48-
#[test_case(r#"abc\"abc\""# => Some(0b00_0000_0000))]
49-
#[test_case(r#"abc\\"abc\\""# => Some(0b0111_1110_0000))]
50-
#[test_case(r#"{"aaa":[{},{"b":{"c":[1,2,3]}}],"# => Some(0b0000_0000_0000_0110_0011_0000_0001_1110))]
51-
fn single_block(str: &str) -> Option<u32> {
44+
#[test_case("", 0)]
45+
#[test_case("abcd", 0)]
46+
#[test_case(r#""abcd""#, 0b01_1111)]
47+
#[test_case(r#""num": 42, "string": "something" "#, 0b0_0111_1111_1110_0011_1111_1000_0000_1111)]
48+
#[test_case(r#"abc\"abc\""#, 0b00_0000_0000)]
49+
#[test_case(r#"abc\\"abc\\""#, 0b0111_1110_0000)]
50+
#[test_case(r#"{"aaa":[{},{"b":{"c":[1,2,3]}}],"#, 0b0000_0000_0000_0110_0011_0000_0001_1110)]
51+
fn single_block(str: &str, expected: u32) {
52+
if !std::arch::is_x86_feature_detected!("avx2") {
53+
return;
54+
}
55+
5256
let owned_str = str.to_owned();
53-
let input = OwnedBytes::new(&owned_str).unwrap();
57+
let input = OwnedBytes::from(owned_str);
58+
let mut leading_padding = input.leading_padding_len() as u32;
5459
let iter = input.iter_blocks::<_, 32>(&EmptyRecorder);
55-
let mut classifier = Avx2QuoteClassifier32::new(iter);
56-
classifier.next().unwrap().map(|x| x.within_quotes_mask)
60+
let mut classifier = Constructor::new(iter);
61+
62+
// Drop padding-only blocks.
63+
while leading_padding >= 32 {
64+
let mask = classifier.next().unwrap().unwrap().within_quotes_mask;
65+
assert_eq!(mask, 0);
66+
leading_padding -= 32;
67+
}
68+
69+
// The actual classification is now either contained in the next block,
70+
// or split between the two next blocks. Combine them.
71+
let first_mask = classifier.next().unwrap().unwrap().within_quotes_mask;
72+
let len_in_first_mask = if leading_padding == 0 { 0 } else { 32 - leading_padding };
73+
let second_mask = classifier.next().unwrap().unwrap().within_quotes_mask;
74+
let combined_mask = (first_mask >> leading_padding) | (second_mask << len_in_first_mask);
75+
76+
assert_eq!(combined_mask, expected);
5777
}
5878
}

crates/rsonpath-lib/src/classification/quotes/avx2_64.rs

+33-13
Original file line numberDiff line numberDiff line change
@@ -33,28 +33,48 @@ impl BlockAvx2Classifier {
3333
}
3434
}
3535

36-
#[cfg(all(test, cfg = "avx_64"))]
36+
#[cfg(test)]
3737
mod tests {
38-
use super::Avx2QuoteClassifier64;
38+
use super::{Constructor, QuotesImpl};
3939
use crate::{
4040
input::{Input, OwnedBytes},
4141
result::empty::EmptyRecorder,
4242
FallibleIterator,
4343
};
4444
use test_case::test_case;
4545

46-
#[test_case("" => None)]
47-
#[test_case("abcd" => Some(0))]
48-
#[test_case(r#""abcd""# => Some(0b01_1111))]
49-
#[test_case(r#""number": 42, "string": "something" "# => Some(0b0011_1111_1111_0001_1111_1100_0000_0111_1111))]
50-
#[test_case(r#"abc\"abc\""# => Some(0b00_0000_0000))]
51-
#[test_case(r#"abc\\"abc\\""# => Some(0b0111_1110_0000))]
52-
#[test_case(r#"{"aaa":[{},{"b":{"c":[1,2,3]}}],"e":{"a":[[],[1,2,3],"# => Some(0b0_0000_0000_0000_0110_0011_0000_0000_0000_0110_0011_0000_0001_1110))]
53-
fn single_block(str: &str) -> Option<u64> {
46+
#[test_case("", 0)]
47+
#[test_case("abcd", 0)]
48+
#[test_case(r#""abcd""#, 0b01_1111)]
49+
#[test_case(r#""num": 42, "string": "something" "#, 0b0_0111_1111_1110_0011_1111_1000_0000_1111)]
50+
#[test_case(r#"abc\"abc\""#, 0b00_0000_0000)]
51+
#[test_case(r#"abc\\"abc\\""#, 0b0111_1110_0000)]
52+
#[test_case(r#"{"aaa":[{},{"b":{"c":[1,2,3]}}],"#, 0b0000_0000_0000_0110_0011_0000_0001_1110)]
53+
fn single_block(str: &str, expected: u64) {
54+
if !std::arch::is_x86_feature_detected!("avx2") {
55+
return;
56+
}
57+
5458
let owned_str = str.to_owned();
55-
let input = OwnedBytes::new(&owned_str).unwrap();
59+
let input = OwnedBytes::from(owned_str);
60+
let mut leading_padding = input.leading_padding_len() as u64;
5661
let iter = input.iter_blocks::<_, 64>(&EmptyRecorder);
57-
let mut classifier = Avx2QuoteClassifier64::new(iter);
58-
classifier.next().unwrap().map(|x| x.within_quotes_mask)
62+
let mut classifier = Constructor::new(iter);
63+
64+
// Drop padding-only blocks.
65+
while leading_padding >= 64 {
66+
let mask = classifier.next().unwrap().unwrap().within_quotes_mask;
67+
assert_eq!(mask, 0);
68+
leading_padding -= 64;
69+
}
70+
71+
// The actual classification is now either contained in the next block,
72+
// or split between the two next blocks. Combine them.
73+
let first_mask = classifier.next().unwrap().unwrap().within_quotes_mask;
74+
let len_in_first_mask = if leading_padding == 0 { 0 } else { 64 - leading_padding };
75+
let second_mask = classifier.next().unwrap().unwrap().within_quotes_mask;
76+
let combined_mask = (first_mask >> leading_padding) | (second_mask << len_in_first_mask);
77+
78+
assert_eq!(combined_mask, expected);
5979
}
6080
}

crates/rsonpath-lib/src/classification/quotes/sse2_32.rs

+33-13
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,48 @@ impl BlockSse2Classifier {
3434
}
3535
}
3636

37-
#[cfg(all(test, cfg = "ssse3_32"))]
37+
#[cfg(test)]
3838
mod tests {
39-
use super::Sse2QuoteClassifier32;
39+
use super::{Constructor, QuotesImpl};
4040
use crate::{
4141
input::{Input, OwnedBytes},
4242
result::empty::EmptyRecorder,
4343
FallibleIterator,
4444
};
4545
use test_case::test_case;
4646

47-
#[test_case("" => None)]
48-
#[test_case("abcd" => Some(0))]
49-
#[test_case(r#""abcd""# => Some(0b01_1111))]
50-
#[test_case(r#""num": 42, "string": "something" "# => Some(0b0_0111_1111_1110_0011_1111_1000_0000_1111))]
51-
#[test_case(r#"abc\"abc\""# => Some(0b00_0000_0000))]
52-
#[test_case(r#"abc\\"abc\\""# => Some(0b0111_1110_0000))]
53-
#[test_case(r#"{"aaa":[{},{"b":{"c":[1,2,3]}}],"# => Some(0b0000_0000_0000_0110_0011_0000_0001_1110))]
54-
fn single_block(str: &str) -> Option<u32> {
47+
#[test_case("", 0)]
48+
#[test_case("abcd", 0)]
49+
#[test_case(r#""abcd""#, 0b01_1111)]
50+
#[test_case(r#""num": 42, "string": "something" "#, 0b0_0111_1111_1110_0011_1111_1000_0000_1111)]
51+
#[test_case(r#"abc\"abc\""#, 0b00_0000_0000)]
52+
#[test_case(r#"abc\\"abc\\""#, 0b0111_1110_0000)]
53+
#[test_case(r#"{"aaa":[{},{"b":{"c":[1,2,3]}}],"#, 0b0000_0000_0000_0110_0011_0000_0001_1110)]
54+
fn single_block(str: &str, expected: u32) {
55+
if !std::arch::is_x86_feature_detected!("sse2") {
56+
return;
57+
}
58+
5559
let owned_str = str.to_owned();
56-
let input = OwnedBytes::new(&owned_str).unwrap();
60+
let input = OwnedBytes::from(owned_str);
61+
let mut leading_padding = input.leading_padding_len() as u32;
5762
let iter = input.iter_blocks::<_, 32>(&EmptyRecorder);
58-
let mut classifier = Sse2QuoteClassifier32::new(iter);
59-
classifier.next().unwrap().map(|x| x.within_quotes_mask)
63+
let mut classifier = Constructor::new(iter);
64+
65+
// Drop padding-only blocks.
66+
while leading_padding >= 32 {
67+
let mask = classifier.next().unwrap().unwrap().within_quotes_mask;
68+
assert_eq!(mask, 0);
69+
leading_padding -= 32;
70+
}
71+
72+
// The actual classification is now either contained in the next block,
73+
// or split between the two next blocks. Combine them.
74+
let first_mask = classifier.next().unwrap().unwrap().within_quotes_mask;
75+
let len_in_first_mask = if leading_padding == 0 { 0 } else { 32 - leading_padding };
76+
let second_mask = classifier.next().unwrap().unwrap().within_quotes_mask;
77+
let combined_mask = (first_mask >> leading_padding) | (second_mask << len_in_first_mask);
78+
79+
assert_eq!(combined_mask, expected);
6080
}
6181
}

crates/rsonpath-lib/src/classification/quotes/sse2_64.rs

+32-13
Original file line numberDiff line numberDiff line change
@@ -46,28 +46,47 @@ impl BlockSse2Classifier {
4646
}
4747
}
4848

49-
#[cfg(all(test, cfg = "ssse3_64"))]
49+
#[cfg(test)]
5050
mod tests {
51-
use super::Sse2QuoteClassifier64;
51+
use super::{Constructor, QuotesImpl};
5252
use crate::{
5353
input::{Input, OwnedBytes},
5454
result::empty::EmptyRecorder,
5555
FallibleIterator,
5656
};
5757
use test_case::test_case;
5858

59-
#[test_case("" => None)]
60-
#[test_case("abcd" => Some(0))]
61-
#[test_case(r#""abcd""# => Some(0b01_1111))]
62-
#[test_case(r#""number": 42, "string": "something" "# => Some(0b0011_1111_1111_0001_1111_1100_0000_0111_1111))]
63-
#[test_case(r#"abc\"abc\""# => Some(0b00_0000_0000))]
64-
#[test_case(r#"abc\\"abc\\""# => Some(0b0111_1110_0000))]
65-
#[test_case(r#"{"aaa":[{},{"b":{"c":[1,2,3]}}],"e":{"a":[[],[1,2,3],"# => Some(0b0_0000_0000_0000_0110_0011_0000_0000_0000_0110_0011_0000_0001_1110))]
66-
fn single_block(str: &str) -> Option<u64> {
59+
#[test_case("", 0)]
60+
#[test_case("abcd", 0)]
61+
#[test_case(r#""abcd""#, 0b01_1111)]
62+
#[test_case(r#""num": 42, "string": "something" "#, 0b0_0111_1111_1110_0011_1111_1000_0000_1111)]
63+
#[test_case(r#"abc\"abc\""#, 0b00_0000_0000)]
64+
#[test_case(r#"abc\\"abc\\""#, 0b0111_1110_0000)]
65+
#[test_case(r#"{"aaa":[{},{"b":{"c":[1,2,3]}}],"#, 0b0000_0000_0000_0110_0011_0000_0001_1110)]
66+
fn single_block(str: &str, expected: u64) {
67+
if !std::arch::is_x86_feature_detected!("sse2") {
68+
return;
69+
}
70+
6771
let owned_str = str.to_owned();
68-
let input = OwnedBytes::new(&owned_str).unwrap();
72+
let input = OwnedBytes::from(owned_str);
73+
let mut leading_padding = input.leading_padding_len() as u64;
6974
let iter = input.iter_blocks::<_, 64>(&EmptyRecorder);
70-
let mut classifier = Sse2QuoteClassifier64::new(iter);
71-
classifier.next().unwrap().map(|x| x.within_quotes_mask)
75+
let mut classifier = Constructor::new(iter);
76+
77+
// Drop padding-only blocks.
78+
while leading_padding >= 64 {
79+
let mask = classifier.next().unwrap().unwrap().within_quotes_mask;
80+
assert_eq!(mask, 0);
81+
leading_padding -= 64;
82+
}
83+
// The actual classification is now either contained in the next block,
84+
// or split between the two next blocks. Combine them.
85+
let first_mask = classifier.next().unwrap().unwrap().within_quotes_mask;
86+
let len_in_first_mask = if leading_padding == 0 { 0 } else { 64 - leading_padding };
87+
let second_mask = classifier.next().unwrap().unwrap().within_quotes_mask;
88+
let combined_mask = (first_mask >> leading_padding) | (second_mask << len_in_first_mask);
89+
90+
assert_eq!(combined_mask, expected);
7291
}
7392
}

crates/rsonpath-lib/src/input/borrowed.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! Choose this implementation if:
44
//!
55
//! 1. You already have the data loaded in-memory and can borrow it while
6-
//! using the engine.
6+
//! using the engine.
77
//!
88
//! ## Performance characteristics
99
//!

crates/rsonpath-lib/src/input/buffered.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//! Choose this implementation if:
55
//!
66
//! 1. You have a [`Read`] source that might contain relatively large amounts
7-
//! of data.
7+
//! of data.
88
//! 2. You want to run the JSONPath query on the input and then discard it.
99
//!
1010
//! ## Performance characteristics

crates/rsonpath-lib/src/input/mmap.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
//!
55
//! 1. Your platform supports memory maps.
66
//! 2. The input data is in a file or comes from standard input:
7-
//! a) if from a file, then you can guarantee that the file is not going to be modified
8-
//! in or out of process while the input is alive;
9-
//! b) if from stdin, then that the input lives in memory (for example comes via a pipe);
10-
//! input from a tty is not memory-mappable.
7+
//! a) if from a file, then you can guarantee that the file is not going to be modified
8+
//! in or out of process while the input is alive;
9+
//! b) if from stdin, then that the input lives in memory (for example comes via a pipe);
10+
//! input from a tty is not memory-mappable.
1111
//!
1212
//! ## Performance characteristics
1313
//!

crates/rsonpath-lib/src/input/owned.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//!
55
//! 1. You already have the data loaded in-memory.
66
//! 2. You don't want to deal with ownership and would rather have the input
7-
//! take ownership of the bytes.
7+
//! take ownership of the bytes.
88
//!
99
//! ## Performance characteristics
1010
//!

crates/rsonpath-syntax/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ impl ParserBuilder {
211211
/// JSONPath queries are inherently recursive, since
212212
/// - [`LogicalExpr`] can be an arbitrarily deep tree of AND/OR operators;
213213
/// - the [`TestExpr`] in a filter can test arbitrary nested JSONPath queries.
214+
///
214215
/// Our parser implementation is recursive, so an excessively nested query could overflow the stack.
215216
///
216217
/// The limit can be relaxed here, or removed entirely by passing [`None`].

0 commit comments

Comments
 (0)