diff options
Diffstat (limited to 'src/nix')
-rw-r--r-- | src/nix/develop.cc | 2 | ||||
-rw-r--r-- | src/nix/doctor.cc | 2 | ||||
-rw-r--r-- | src/nix/flake.cc | 2 | ||||
-rw-r--r-- | src/nix/prefetch.cc | 2 | ||||
-rw-r--r-- | src/nix/upgrade-nix.cc | 4 |
5 files changed, 6 insertions, 6 deletions
diff --git a/src/nix/develop.cc b/src/nix/develop.cc index 9ecfdef5d..b5543447e 100644 --- a/src/nix/develop.cc +++ b/src/nix/develop.cc @@ -448,7 +448,7 @@ struct Common : InstallableCommand, MixProfile StorePath getShellOutPath(ref<Store> store, ref<Installable> installable) { auto path = installable->getStorePath(); - if (path && hasSuffix(path->to_string(), "-env")) + if (path && path->to_string().ends_with("-env")) return *path; else { auto drvs = Installable::toDerivations(store, {installable}); diff --git a/src/nix/doctor.cc b/src/nix/doctor.cc index 1aa6831d3..531f0ad86 100644 --- a/src/nix/doctor.cc +++ b/src/nix/doctor.cc @@ -101,7 +101,7 @@ struct CmdDoctor : StoreCommand try { Path userEnv = canonPath(profileDir, true); - if (store->isStorePath(userEnv) && hasSuffix(userEnv, "user-environment")) { + if (store->isStorePath(userEnv) && userEnv.ends_with("user-environment")) { while (profileDir.find("/profiles/") == std::string::npos && isLink(profileDir)) profileDir = absPath(readLink(profileDir), dirOf(profileDir)); diff --git a/src/nix/flake.cc b/src/nix/flake.cc index bbefff87a..6b3012558 100644 --- a/src/nix/flake.cc +++ b/src/nix/flake.cc @@ -334,7 +334,7 @@ struct CmdFlakeCheck : FlakeCommand return name == expected || name == "_" - || (hasPrefix(name, "_") && name.substr(1) == expected); + || (name.starts_with("_") && name.substr(1) == expected); }; auto checkSystemName = [&](const std::string & system, const PosIdx pos) { diff --git a/src/nix/prefetch.cc b/src/nix/prefetch.cc index 9f2d6cc57..0104635fb 100644 --- a/src/nix/prefetch.cc +++ b/src/nix/prefetch.cc @@ -42,7 +42,7 @@ std::string resolveMirrorUrl(EvalState & state, const std::string & url) throw Error("mirror URL '%s' did not expand to anything", url); std::string mirror(state.forceString(*mirrorList->value->listElems()[0], noPos, "while evaluating the first available mirror")); - return mirror + (hasSuffix(mirror, "/") ? "" : "/") + s.substr(p + 1); + return mirror + (mirror.ends_with("/") ? "" : "/") + s.substr(p + 1); } std::tuple<StorePath, Hash> prefetchFile( diff --git a/src/nix/upgrade-nix.cc b/src/nix/upgrade-nix.cc index d238456db..af219c1b9 100644 --- a/src/nix/upgrade-nix.cc +++ b/src/nix/upgrade-nix.cc @@ -115,7 +115,7 @@ struct CmdUpgradeNix : MixDryRun, StoreCommand printInfo("found Nix in '%s'", where); - if (hasPrefix(where, "/run/current-system")) + if (where.starts_with("/run/current-system")) throw Error("Nix on NixOS must be upgraded via 'nixos-rebuild'"); Path profileDir = dirOf(where); @@ -129,7 +129,7 @@ struct CmdUpgradeNix : MixDryRun, StoreCommand Path userEnv = canonPath(profileDir, true); if (baseNameOf(where) != "bin" || - !hasSuffix(userEnv, "user-environment")) + !userEnv.ends_with("user-environment")) throw Error("directory '%s' does not appear to be part of a Nix profile", where); if (!store->isValidPath(store->parseStorePath(userEnv))) |