libexpr: Use table.size() instead of unnecessary loop
(cherry picked from commit d8fc55a46e0c09241131097dbf1d6fa09e0a9808) Upstream-PR: https://github.com/NixOS/nix/pull/13741 Change-Id: I8a11e21ae3bff3a885e13fbab74e1deb162a34cf
This commit is contained in:
@@ -18,14 +18,7 @@ void prim_fromTOML(EvalState & state, Value ** args, Value & val)
|
||||
switch (t.type()) {
|
||||
case toml::value_t::table: {
|
||||
auto table = toml::get<toml::table>(t);
|
||||
|
||||
size_t size = 0;
|
||||
for (auto & i : table) {
|
||||
(void) i;
|
||||
size++;
|
||||
}
|
||||
|
||||
auto attrs = state.ctx.buildBindings(size);
|
||||
auto attrs = state.ctx.buildBindings(table.size());
|
||||
|
||||
for (auto & elem : table) {
|
||||
self(attrs.alloc(elem.first), elem.second);
|
||||
|
||||
Reference in New Issue
Block a user