diff options
author | Jade Lovelace <lix@jade.fyi> | 2024-03-17 19:14:18 -0700 |
---|---|---|
committer | Jade Lovelace <lix@jade.fyi> | 2024-03-17 20:17:19 -0700 |
commit | 61e21b25576f7f3491f6a837bf59d8b44c6897a0 (patch) | |
tree | 3f62d83b3bab84afcf1011b5c2353226b84313b3 /src/libexpr/flake | |
parent | 706cee5c493b39e25bdb0add55d2e1771dc31696 (diff) |
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
Diffstat (limited to 'src/libexpr/flake')
-rw-r--r-- | src/libexpr/flake/config.cc | 2 | ||||
-rw-r--r-- | src/libexpr/flake/flakeref.cc | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/libexpr/flake/config.cc b/src/libexpr/flake/config.cc index e89014862..b9613462a 100644 --- a/src/libexpr/flake/config.cc +++ b/src/libexpr/flake/config.cc @@ -35,7 +35,7 @@ void ConfigFile::apply() for (auto & [name, value] : settings) { - auto baseName = hasPrefix(name, "extra-") ? std::string(name, 6) : name; + auto baseName = name.starts_with("extra-") ? std::string(name, 6) : name; // FIXME: Move into libutil/config.cc. std::string valueS; diff --git a/src/libexpr/flake/flakeref.cc b/src/libexpr/flake/flakeref.cc index e1bce90bc..1c90bfc43 100644 --- a/src/libexpr/flake/flakeref.cc +++ b/src/libexpr/flake/flakeref.cc @@ -186,7 +186,7 @@ std::pair<FlakeRef, std::string> parseFlakeRefWithFragment( } } else { - if (!hasPrefix(path, "/")) + if (!path.starts_with("/")) throw BadURL("flake reference '%s' is not an absolute path", url); auto query = decodeQuery(match[2]); path = canonPath(path + "/" + getOr(query, "dir", "")); |