about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-07-31T21·19+0200
committerflokli <flokli@flokli.de>2023-07-31T21·59+0000
commit8258dbecdfb518bd52ad83d39b0a85e0a279b426 (patch)
tree0d76ab43998d1de39eca903558bdd5f32df85bf2
parent779fad29a12e3dd5206d5a5488ddce517390132e (diff)
refactor(tvix/nix-compat/derivation): drop some useless allocations r/6455
Change-Id: I85e44e24e9ec3fe4284f02623a1ac7ca9935e554
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8999
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
-rw-r--r--tvix/nix-compat/src/derivation/write.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/tvix/nix-compat/src/derivation/write.rs b/tvix/nix-compat/src/derivation/write.rs
index 5937f619b719..d84992a3cbc4 100644
--- a/tvix/nix-compat/src/derivation/write.rs
+++ b/tvix/nix-compat/src/derivation/write.rs
@@ -126,8 +126,8 @@ pub fn write_input_derivations(
             writer,
             &input_derivation
                 .iter()
-                .map(|s| s.as_bytes().to_vec().into())
-                .collect::<Vec<BString>>(),
+                .map(String::as_bytes)
+                .collect::<Vec<_>>(),
         )?;
         write_char(writer, BRACKET_CLOSE)?;
 
@@ -146,10 +146,7 @@ pub fn write_input_sources(
     write_char(writer, BRACKET_OPEN)?;
     write_array_elements(
         writer,
-        &input_sources
-            .iter()
-            .map(|s| s.as_bytes().to_vec().into())
-            .collect::<Vec<BString>>(),
+        &input_sources.iter().map(String::from).collect::<Vec<_>>(),
     )?;
     write_char(writer, BRACKET_CLOSE)?;