From 61e21b25576f7f3491f6a837bf59d8b44c6897a0 Mon Sep 17 00:00:00 2001 From: Jade Lovelace Date: Sun, 17 Mar 2024 19:14:18 -0700 Subject: Delete hasPrefix and hasSuffix from the codebase These now have equivalents in the standard lib in C++20. This change was performed with a custom clang-tidy check which I will submit later. Executed like so: ninja -C build && run-clang-tidy -checks='-*,nix-*' -load=build/libnix-clang-tidy.so -p .. -fix ../tests | tee -a clang-tidy-result Change-Id: I62679e315ff9e7ce72a40b91b79c3e9fc01b27e9 --- src/libexpr/eval-settings.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/libexpr/eval-settings.cc') diff --git a/src/libexpr/eval-settings.cc b/src/libexpr/eval-settings.cc index 89ca198d8..046ca557d 100644 --- a/src/libexpr/eval-settings.cc +++ b/src/libexpr/eval-settings.cc @@ -29,7 +29,7 @@ static Strings parseNixPath(const std::string & s) if (*p == ':') { auto prefix = std::string(start2, s.end()); - if (EvalSettings::isPseudoUrl(prefix) || hasPrefix(prefix, "flake:")) { + if (EvalSettings::isPseudoUrl(prefix) || prefix.starts_with("flake:")) { ++p; while (p != s.end() && *p != ':') ++p; } @@ -82,7 +82,7 @@ bool EvalSettings::isPseudoUrl(std::string_view s) std::string EvalSettings::resolvePseudoUrl(std::string_view url) { - if (hasPrefix(url, "channel:")) + if (url.starts_with("channel:")) return "https://nixos.org/channels/" + std::string(url.substr(8)) + "/nixexprs.tar.xz"; else return std::string(url); -- cgit v1.2.3