Skip to content

Commit 19d9a87

Browse files
xokdviumemilazy
authored andcommitted
libexpr: Use table.size() instead of unnecessary loop
(cherry picked from commit d8fc55a46e0c09241131097dbf1d6fa09e0a9808) Upstream-PR: NixOS/nix#13741 Change-Id: I8a11e21ae3bff3a885e13fbab74e1deb162a34cf
1 parent 5badc1b commit 19d9a87

1 file changed

Lines changed: 1 addition & 8 deletions

File tree

lix/libexpr/primops/fromTOML.cc

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,7 @@ void prim_fromTOML(EvalState & state, Value ** args, Value & val)
1818
switch (t.type()) {
1919
case toml::value_t::table: {
2020
auto table = toml::get<toml::table>(t);
21-
22-
size_t size = 0;
23-
for (auto & i : table) {
24-
(void) i;
25-
size++;
26-
}
27-
28-
auto attrs = state.ctx.buildBindings(size);
21+
auto attrs = state.ctx.buildBindings(table.size());
2922

3023
for (auto & elem : table) {
3124
self(attrs.alloc(elem.first), elem.second);

0 commit comments

Comments
 (0)