Skip to content

Commit 91bb69e

Browse files
Manishearthzbraniecki
authored andcommitted
Use smallvec for scope tracking (#118)
1 parent 47bcb83 commit 91bb69e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

fluent-bundle/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ failure = "^0.1"
2727
failure_derive = "^0.1"
2828
intl_pluralrules = "^1.0"
2929
rental = "^0.5.4"
30+
smallvec = "0.6.10"
3031

3132
[[bench]]
3233
name = "resolver"

fluent-bundle/src/resolve.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub struct Scope<'bundle, R: Borrow<FluentResource>> {
4040
/// Local args
4141
pub local_args: Option<HashMap<&'bundle str, FluentValue<'bundle>>>,
4242
/// Tracks hashes to prevent infinite recursion.
43-
pub travelled: RefCell<Vec<u64>>,
43+
pub travelled: RefCell<smallvec::SmallVec<[u64; 2]>>,
4444
/// Track errors accumulated during resolving.
4545
pub errors: Vec<ResolverError>,
4646
}
@@ -54,7 +54,7 @@ impl<'bundle, R: Borrow<FluentResource>> Scope<'bundle, R> {
5454
bundle,
5555
args,
5656
local_args: None,
57-
travelled: RefCell::new(Vec::new()),
57+
travelled: RefCell::new(smallvec::SmallVec::new()),
5858
errors: vec![],
5959
}
6060
}

0 commit comments

Comments
 (0)