diff options
author | Vincent Ambo <tazjin@google.com> | 2020-05-24T21·29+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-05-24T21·29+0100 |
commit | 838f86b0fd880b26539664140f04e5d16669dad8 (patch) | |
tree | c8fee2f0c136fbe5bb0735604e2f04d5b02698ba /third_party/nix/src/nix-prefetch-url | |
parent | f30b2e610d9e612504a9f6460e0cc83413b80aeb (diff) |
style(3p/nix): Remove 'using std::*' from types.hh r/840
It is considered bad form to use things from includes in headers, as these directives propagate to everywhere else and can make it confusing. types.hh (which is includes almost literally everywhere) had some of these directives, which this commit removes.
Diffstat (limited to 'third_party/nix/src/nix-prefetch-url')
-rw-r--r-- | third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc b/third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc index fa88dc9bc67e..a2cd570986e8 100644 --- a/third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc +++ b/third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc @@ -20,17 +20,17 @@ using namespace nix; /* If ‘uri’ starts with ‘mirror://’, then resolve it using the list of mirrors defined in Nixpkgs. */ -string resolveMirrorUri(EvalState& state, string uri) { - if (string(uri, 0, 9) != "mirror://") { +std::string resolveMirrorUri(EvalState& state, std::string uri) { + if (std::string(uri, 0, 9) != "mirror://") { return uri; } - string s(uri, 9); + std::string s(uri, 9); auto p = s.find('/'); - if (p == string::npos) { + if (p == std::string::npos) { throw Error("invalid mirror URI"); } - string mirrorName(s, 0, p); + std::string mirrorName(s, 0, p); Value vMirrors; state.eval( @@ -49,19 +49,20 @@ string resolveMirrorUri(EvalState& state, string uri) { throw Error(format("mirror URI '%1%' did not expand to anything") % uri); } - string mirror = state.forceString(*mirrorList->second.value->listElems()[0]); - return mirror + (hasSuffix(mirror, "/") ? "" : "/") + string(s, p + 1); + std::string mirror = + state.forceString(*mirrorList->second.value->listElems()[0]); + return mirror + (hasSuffix(mirror, "/") ? "" : "/") + std::string(s, p + 1); } static int _main(int argc, char** argv) { { HashType ht = htSHA256; - std::vector<string> args; + std::vector<std::string> args; bool printPath = !getEnv("PRINT_PATH").empty(); bool fromExpr = false; - string attrPath; + std::string attrPath; bool unpack = false; - string name; + std::string name; struct MyArgs : LegacyArgs, MixEvalArgs { using LegacyArgs::LegacyArgs; @@ -74,7 +75,7 @@ static int _main(int argc, char** argv) { } else if (*arg == "--version") { printVersion("nix-prefetch-url"); } else if (*arg == "--type") { - string s = getArg(*arg, arg, end); + std::string s = getArg(*arg, arg, end); ht = parseHashType(s); if (ht == htUnknown) { throw UsageError(format("unknown hash type '%1%'") % s); @@ -111,7 +112,7 @@ static int _main(int argc, char** argv) { /* If -A is given, get the URI from the specified Nix expression. */ - string uri; + std::string uri; if (!fromExpr) { if (args.empty()) { throw UsageError("you must specify a URI"); |