Skip to content

Commit a9d557b

Browse files
committed
use latest SmallVec too
1 parent 2af2cf1 commit a9d557b

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

crates/jiter/Cargo.toml

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

2323
[features]

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: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub enum JsonValue<'s> {
2525
Object(JsonObject<'s>),
2626
}
2727

28-
pub type JsonArray<'s> = Arc<SmallVec<[JsonValue<'s>; 8]>>;
28+
pub type JsonArray<'s> = Arc<SmallVec<JsonValue<'s>, 8>>;
2929
pub type JsonObject<'s> = Arc<LazyIndexMap<Cow<'s, str>, JsonValue<'s>>>;
3030

3131
#[cfg(feature = "python")]
@@ -85,7 +85,9 @@ fn value_static(v: JsonValue<'_>) -> JsonValue<'static> {
8585
JsonValue::BigInt(b) => JsonValue::BigInt(b),
8686
JsonValue::Float(f) => JsonValue::Float(f),
8787
JsonValue::Str(s) => JsonValue::Str(s.into_owned().into()),
88-
JsonValue::Array(v) => JsonValue::Array(Arc::new(v.iter().map(JsonValue::to_static).collect::<SmallVec<_>>())),
88+
JsonValue::Array(v) => {
89+
JsonValue::Array(Arc::new(v.iter().map(JsonValue::to_static).collect::<SmallVec<_, 8>>()))
90+
}
8991
JsonValue::Object(o) => JsonValue::Object(Arc::new(o.to_static())),
9092
}
9193
}

0 commit comments

Comments
 (0)