diff options
author | Vincent Ambo <tazjin@google.com> | 2020-05-25T01·19+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-05-25T01·19+0100 |
commit | b99b368d17f2e806a61f7abb83c6d3a9e4bbdc38 (patch) | |
tree | 1f76047dd027421dcf79cdf4804fa5ff1bb08b2b /third_party/nix/src/libstore/machines.cc | |
parent | 8cf1322a6fd5ae282d8a09fdba634f27a1a88560 (diff) |
refactor(3p/nix/libutil): Replace hasPrefix/Suffix with Abseil r/845
Uses the equivalent absl::StartsWith and absl::EndsWith functions instead.
Diffstat (limited to 'third_party/nix/src/libstore/machines.cc')
-rw-r--r-- | third_party/nix/src/libstore/machines.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/third_party/nix/src/libstore/machines.cc b/third_party/nix/src/libstore/machines.cc index 6472e037d14c..bbb84784c4f0 100644 --- a/third_party/nix/src/libstore/machines.cc +++ b/third_party/nix/src/libstore/machines.cc @@ -3,6 +3,7 @@ #include <algorithm> #include <absl/strings/ascii.h> +#include <absl/strings/match.h> #include <absl/strings/string_view.h> #include <glog/logging.h> @@ -21,9 +22,10 @@ Machine::Machine(decltype(storeUri)& storeUri, // Backwards compatibility: if the URI is a hostname, // prepend ssh://. storeUri.find("://") != std::string::npos || - hasPrefix(storeUri, "local") || - hasPrefix(storeUri, "remote") || - hasPrefix(storeUri, "auto") || hasPrefix(storeUri, "/") + absl::StartsWith(storeUri, "local") || + absl::StartsWith(storeUri, "remote") || + absl::StartsWith(storeUri, "auto") || + absl::StartsWith(storeUri, "/") ? storeUri : "ssh://" + storeUri), systemTypes(systemTypes), |