diff options
author | edef <edef@edef.eu> | 2023-10-17T14·37+0000 |
---|---|---|
committer | edef <edef@edef.eu> | 2023-10-18T11·42+0000 |
commit | 2cae6a02b9267e794c77cc052927dcfc5839d979 (patch) | |
tree | 4915d3ade4665cca02e2211e004007ae8912ea91 /tvix/nix-compat/src/nar | |
parent | 6638f4d4ea6848fe6fc2dc89271f0b6950764729 (diff) |
refactor(nix-compat/nar/writer): use clone_into r/6854
Equivalent to the existing code, but a little less cryptic. Change-Id: Ib9b2f9aedddc84d0e79840bba4cce01f92d9bc56 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9766 Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/nix-compat/src/nar')
-rw-r--r-- | tvix/nix-compat/src/nar/writer/async.rs | 3 | ||||
-rw-r--r-- | tvix/nix-compat/src/nar/writer/sync.rs | 3 |
2 files changed, 2 insertions, 4 deletions
diff --git a/tvix/nix-compat/src/nar/writer/async.rs b/tvix/nix-compat/src/nar/writer/async.rs index 2b73e56737ce..dd5c72ac8913 100644 --- a/tvix/nix-compat/src/nar/writer/async.rs +++ b/tvix/nix-compat/src/nar/writer/async.rs @@ -203,8 +203,7 @@ impl<'a, 'w> Directory<'a, 'w> { _prev_name.as_bstr(), name.as_bstr() ); - _prev_name.clear(); - _prev_name.extend_from_slice(name); + name.clone_into(_prev_name); } self.node.write(&wire::TOK_PAR).await?; } diff --git a/tvix/nix-compat/src/nar/writer/sync.rs b/tvix/nix-compat/src/nar/writer/sync.rs index 9290e4a5bdfe..071aab831c20 100644 --- a/tvix/nix-compat/src/nar/writer/sync.rs +++ b/tvix/nix-compat/src/nar/writer/sync.rs @@ -192,8 +192,7 @@ impl<'a, 'w> Directory<'a, 'w> { _prev_name.as_bstr(), name.as_bstr() ); - _prev_name.clear(); - _prev_name.extend_from_slice(name); + name.clone_into(_prev_name); } self.node.write(&wire::TOK_PAR)?; } |