From 838f86b0fd880b26539664140f04e5d16669dad8 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 24 May 2020 22:29:21 +0100 Subject: style(3p/nix): Remove 'using std::*' from types.hh 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. --- third_party/nix/src/libutil/types.hh | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'third_party/nix/src/libutil/types.hh') diff --git a/third_party/nix/src/libutil/types.hh b/third_party/nix/src/libutil/types.hh index ac1b802ce0f1..ad44719afe3a 100644 --- a/third_party/nix/src/libutil/types.hh +++ b/third_party/nix/src/libutil/types.hh @@ -22,10 +22,6 @@ namespace nix { /* Inherit some names from other namespaces for convenience. */ using boost::format; -using std::list; -using std::set; -using std::string; -using std::vector; /* A variadic template that does nothing. Useful to call a function for all variadic arguments but ignoring the result. */ @@ -35,8 +31,8 @@ struct nop { }; struct FormatOrString { - string s; - FormatOrString(const string& s) : s(s){}; + std::string s; + FormatOrString(const std::string& s) : s(s){}; FormatOrString(const format& f) : s(f.str()){}; FormatOrString(const char* s) : s(s){}; }; @@ -64,8 +60,8 @@ inline std::string fmt(const std::string& fs, Args... args) { a subclass. Catch Error instead. */ class BaseError : public std::exception { protected: - string prefix_; // used for location traces etc. - string err; + std::string prefix_; // used for location traces etc. + std::string err; public: unsigned int status = 1; // exit status @@ -84,8 +80,8 @@ class BaseError : public std::exception { const char* what() const noexcept { return err.c_str(); } #endif - const string& msg() const { return err; } - const string& prefix() const { return prefix_; } + const std::string& msg() const { return err; } + const std::string& prefix() const { return prefix_; } BaseError& addPrefix(const FormatOrString& fs); }; @@ -108,13 +104,13 @@ MakeError(Error, BaseError) std::string addErrno(const std::string& s); }; -typedef list Strings; -typedef set StringSet; +typedef std::list Strings; +typedef std::set StringSet; typedef std::map StringMap; /* Paths are just strings. */ -typedef string Path; -typedef list Paths; -typedef set PathSet; +typedef std::string Path; +typedef std::list Paths; +typedef std::set PathSet; } // namespace nix -- cgit 1.4.1