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/libmain | |
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/libmain')
-rw-r--r-- | src/libmain/common-args.cc | 2 | ||||
-rw-r--r-- | src/libmain/progress-bar.cc | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/libmain/common-args.cc b/src/libmain/common-args.cc index f92920d18..75feccbed 100644 --- a/src/libmain/common-args.cc +++ b/src/libmain/common-args.cc @@ -47,7 +47,7 @@ MixCommonArgs::MixCommonArgs(const std::string & programName) std::map<std::string, Config::SettingInfo> settings; globalConfig.getSettings(settings); for (auto & s : settings) - if (hasPrefix(s.first, prefix)) + if (s.first.starts_with(prefix)) completions->add(s.first, fmt("Set the `%s` setting.", s.first)); } } diff --git a/src/libmain/progress-bar.cc b/src/libmain/progress-bar.cc index 45b1fdfd1..5c648ccf7 100644 --- a/src/libmain/progress-bar.cc +++ b/src/libmain/progress-bar.cc @@ -188,7 +188,7 @@ public: if (type == actBuild) { std::string name(storePathToName(getS(fields, 0))); - if (hasSuffix(name, ".drv")) + if (name.ends_with(".drv")) name = name.substr(0, name.size() - 4); i->s = fmt("building " ANSI_BOLD "%s" ANSI_NORMAL, name); auto machineName = getS(fields, 1); @@ -207,7 +207,7 @@ public: auto name = storePathToName(getS(fields, 0)); auto sub = getS(fields, 1); i->s = fmt( - hasPrefix(sub, "local") + sub.starts_with("local") ? "copying " ANSI_BOLD "%s" ANSI_NORMAL " from %s" : "fetching " ANSI_BOLD "%s" ANSI_NORMAL " from %s", name, sub); @@ -215,7 +215,7 @@ public: if (type == actPostBuildHook) { auto name = storePathToName(getS(fields, 0)); - if (hasSuffix(name, ".drv")) + if (name.ends_with(".drv")) name = name.substr(0, name.size() - 4); i->s = fmt("post-build " ANSI_BOLD "%s" ANSI_NORMAL, name); i->name = DrvName(name).name; |