about summary refs log tree commit diff
path: root/tvix/nix-compat/src/derivation/escape.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/nix-compat/src/derivation/escape.rs')
-rw-r--r--tvix/nix-compat/src/derivation/escape.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/tvix/nix-compat/src/derivation/escape.rs b/tvix/nix-compat/src/derivation/escape.rs
index 8c2c6fce07..06b550bbf0 100644
--- a/tvix/nix-compat/src/derivation/escape.rs
+++ b/tvix/nix-compat/src/derivation/escape.rs
@@ -1,7 +1,7 @@
-use bstr::{BString, ByteSlice};
+use bstr::ByteSlice;
 
 /// Escapes a byte sequence. Does not add surrounding quotes.
-pub fn escape_bstr<P: AsRef<[u8]>>(s: P) -> BString {
+pub fn escape_bytes<P: AsRef<[u8]>>(s: P) -> Vec<u8> {
     let mut s: Vec<u8> = s.as_ref().to_vec();
 
     s = s.replace(b"\\", b"\\\\");
@@ -10,18 +10,18 @@ pub fn escape_bstr<P: AsRef<[u8]>>(s: P) -> BString {
     s = s.replace(b"\t", b"\\t");
     s = s.replace(b"\"", b"\\\"");
 
-    s.into()
+    s
 }
 
 #[cfg(test)]
 mod tests {
-    use super::escape_bstr;
+    use super::escape_bytes;
     use test_case::test_case;
 
     #[test_case(b"", b""; "empty")]
     #[test_case(b"\"", b"\\\""; "doublequote")]
     #[test_case(b":", b":"; "colon")]
     fn escape(input: &[u8], expected: &[u8]) {
-        assert_eq!(expected, escape_bstr(input))
+        assert_eq!(expected, escape_bytes(input))
     }
 }