refactor(nix-compat/nar/reader): reuse prev_name allocation

We reuse the prev_name allocation for Entry, instead of allocating and
returning a separate Vec.

We encode the `prev_name: None` case as an empty vector, since we don't
allow empty names anyway, and the sorting is equivalent.

Change-Id: I975b37ff873805f5ff099bc82128706891052247
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11607
Reviewed-by: Brian Olsen <me@griff.name>
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
This commit is contained in:
edef 2024-05-08 07:13:39 +00:00
parent 17a7dac94f
commit 31d73cd443
8 changed files with 73 additions and 50 deletions

View file

@ -87,7 +87,7 @@ where
let mut path = path.clone();
// valid NAR names are valid castore names
path.try_push(&entry.name)
path.try_push(entry.name)
.expect("Tvix bug: failed to join name");
let entry = Box::pin(produce_nar_inner(