lib: prefer replaceString over replaceStrings

This commit is contained in:
Gutyina Gergő 2025-05-27 22:26:16 +02:00
parent b5720e2b3f
commit b3b0fd266b
No known key found for this signature in database
3 changed files with 5 additions and 5 deletions

View file

@ -18,7 +18,7 @@ let
concatStrings concatStrings
escape escape
head head
replaceStrings replaceString
; ;
mkPrimitive = t: v: { mkPrimitive = t: v: {
@ -451,7 +451,7 @@ rec {
mkString = mkString =
v: v:
let let
sanitize = s: replaceStrings [ "\n" ] [ "\\n" ] (escape [ "'" "\\" ] s); sanitize = s: replaceString "\n" "\\n" (escape [ "'" "\\" ] s);
in in
mkPrimitive type.string v mkPrimitive type.string v
// { // {

View file

@ -1173,7 +1173,7 @@ rec {
string = toString arg; string = toString arg;
in in
if match "[[:alnum:],._+:@%/-]+" string == null then if match "[[:alnum:],._+:@%/-]+" string == null then
"'${replaceStrings [ "'" ] [ "'\\''" ] string}'" "'${replaceString "'" "'\\''" string}'"
else else
string; string;

View file

@ -14,7 +14,7 @@ let
optionalAttrs optionalAttrs
optionalString optionalString
removeSuffix removeSuffix
replaceStrings replaceString
toUpper toUpper
; ;
@ -522,7 +522,7 @@ let
# #
# https://github.com/rust-lang/cargo/pull/9169 # https://github.com/rust-lang/cargo/pull/9169
# https://github.com/rust-lang/cargo/issues/8285#issuecomment-634202431 # https://github.com/rust-lang/cargo/issues/8285#issuecomment-634202431
cargoEnvVarTarget = replaceStrings [ "-" ] [ "_" ] (toUpper final.rust.cargoShortTarget); cargoEnvVarTarget = replaceString "-" "_" (toUpper final.rust.cargoShortTarget);
# True if the target is no_std # True if the target is no_std
# https://github.com/rust-lang/rust/blob/2e44c17c12cec45b6a682b1e53a04ac5b5fcc9d2/src/bootstrap/config.rs#L415-L421 # https://github.com/rust-lang/rust/blob/2e44c17c12cec45b6a682b1e53a04ac5b5fcc9d2/src/bootstrap/config.rs#L415-L421