Skip to content

Commit 43a493b

Browse files
committed
use latest SmallVec too
1 parent 5e60ec0 commit 43a493b

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

crates/jiter/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ repository = {workspace = true}
1515
num-bigint = "0.4.4"
1616
num-traits = "0.2.16"
1717
ahash = "0.8.0"
18-
smallvec = "1.11.0"
18+
smallvec = "2.0.0-alpha.7"
1919
pyo3 = { workspace = true, optional = true, features = ["num-bigint"] }
2020
lexical-parse-float = { version = "0.8.5", features = ["format"] }
2121
bitvec = "1.0.1"

crates/jiter/src/lazy_index_map.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use smallvec::SmallVec;
1010

1111
/// Like [IndexMap](https://docs.rs/indexmap/latest/indexmap/) but only builds the lookup map when it's needed.
1212
pub struct LazyIndexMap<K, V> {
13-
vec: SmallVec<[(K, V); 8]>,
13+
vec: SmallVec<(K, V), 8>,
1414
map: OnceLock<AHashMap<K, usize>>,
1515
last_find: AtomicUsize,
1616
}
@@ -171,7 +171,7 @@ impl<K, V> From<Vec<(K, V)>> for LazyIndexMap<K, V> {
171171
}
172172

173173
struct IterUnique<'a, K, V> {
174-
vec: &'a SmallVec<[(K, V); 8]>,
174+
vec: &'a SmallVec<(K, V), 8>,
175175
map: &'a AHashMap<K, usize>,
176176
index: usize,
177177
}

crates/jiter/src/python.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ impl<'j, StringCache: StringMaybeCache, KeyCheck: MaybeKeyCheck, ParseNumber: Ma
148148
Ok(None) | Err(_) => return Ok(PyList::empty_bound(py).into_any()),
149149
};
150150

151-
let mut vec: SmallVec<[Bound<'_, PyAny>; 8]> = SmallVec::with_capacity(8);
151+
let mut vec: SmallVec<Bound<'_, PyAny>, 8> = SmallVec::with_capacity(8);
152152
if let Err(e) = self._parse_array(py, peek_first, &mut vec) {
153153
if !self._allow_partial_err(&e) {
154154
return Err(e);
@@ -174,7 +174,7 @@ impl<'j, StringCache: StringMaybeCache, KeyCheck: MaybeKeyCheck, ParseNumber: Ma
174174
&mut self,
175175
py: Python<'py>,
176176
peek_first: Peek,
177-
vec: &mut SmallVec<[Bound<'py, PyAny>; 8]>,
177+
vec: &mut SmallVec<Bound<'py, PyAny>, 8>,
178178
) -> JsonResult<()> {
179179
let v = self._check_take_value(py, peek_first)?;
180180
vec.push(v);

crates/jiter/src/value.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub enum JsonValue<'s> {
2323
Object(JsonObject<'s>),
2424
}
2525

26-
pub type JsonArray<'s> = Arc<SmallVec<[JsonValue<'s>; 8]>>;
26+
pub type JsonArray<'s> = Arc<SmallVec<JsonValue<'s>, 8>>;
2727
pub type JsonObject<'s> = Arc<LazyIndexMap<Cow<'s, str>, JsonValue<'s>>>;
2828

2929
#[cfg(feature = "python")]
@@ -81,7 +81,9 @@ fn value_static(v: JsonValue<'_>) -> JsonValue<'static> {
8181
JsonValue::BigInt(b) => JsonValue::BigInt(b),
8282
JsonValue::Float(f) => JsonValue::Float(f),
8383
JsonValue::Str(s) => JsonValue::Str(s.into_owned().into()),
84-
JsonValue::Array(v) => JsonValue::Array(Arc::new(v.iter().map(JsonValue::to_static).collect::<SmallVec<_>>())),
84+
JsonValue::Array(v) => {
85+
JsonValue::Array(Arc::new(v.iter().map(JsonValue::to_static).collect::<SmallVec<_, 8>>()))
86+
}
8587
JsonValue::Object(o) => JsonValue::Object(Arc::new(o.to_static())),
8688
}
8789
}
@@ -173,7 +175,7 @@ fn take_value<'j, 's>(
173175
}
174176
Peek::Array => {
175177
// we could do something clever about guessing the size of the array
176-
let mut array: SmallVec<[JsonValue<'s>; 8]> = SmallVec::new();
178+
let mut array: SmallVec<JsonValue<'s>, 8> = SmallVec::new();
177179
if let Some(peek_first) = parser.array_first()? {
178180
check_recursion!(recursion_limit, parser.index,
179181
let v = take_value(peek_first, parser, tape, recursion_limit, allow_inf_nan, create_cow)?;

0 commit comments

Comments
 (0)