Skip to content

Commit 4959ad1

Browse files
committed
Further microoptimizations in add_resource
1 parent f127876 commit 4959ad1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

fluent-bundle/src/bundle.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,13 @@ impl<R, M> FluentBundle<R, M> {
186186
let res_pos = self.resources.len();
187187

188188
for (entry_pos, entry) in res.entries().enumerate() {
189-
let (id, entry, kind) = match entry {
189+
let (id, entry) = match entry {
190190
ast::Entry::Message(ast::Message { ref id, .. }) => (
191191
id.name,
192192
Entry::Message((res_pos, entry_pos)),
193-
EntryKind::Message,
194193
),
195194
ast::Entry::Term(ast::Term { ref id, .. }) => {
196-
(id.name, Entry::Term((res_pos, entry_pos)), EntryKind::Term)
195+
(id.name, Entry::Term((res_pos, entry_pos)))
197196
}
198197
_ => continue,
199198
};
@@ -203,6 +202,11 @@ impl<R, M> FluentBundle<R, M> {
203202
empty.insert(entry);
204203
}
205204
HashEntry::Occupied(_) => {
205+
let kind = match entry {
206+
Entry::Message(..) => EntryKind::Message,
207+
Entry::Term(..) => EntryKind::Term,
208+
_ => unreachable!()
209+
};
206210
errors.push(FluentError::Overriding {
207211
kind,
208212
id: id.to_string(),

0 commit comments

Comments
 (0)