diff options
author | Vincent Ambo <tazjin@google.com> | 2020-05-19T17·55+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-05-19T17·55+0100 |
commit | 867055133d3f487e52dd44149f76347c2c28bf10 (patch) | |
tree | c367803ad94f024b0052727a2c7a037af169169a /third_party/nix/src/libutil/config.cc | |
parent | c6a31838cd7e88ebcb01422b329a499d04ab4b6b (diff) |
style(3p/nix): Add braces around single-line conditionals r/771
These were not caught by the previous clang-tidy invocation, but were instead sorted out using amber[0] as such: ambr --regex 'if (\(.+\))\s([a-z].*;)' 'if $1 { $2 }' [0]: https://github.com/dalance/amber
Diffstat (limited to 'third_party/nix/src/libutil/config.cc')
-rw-r--r-- | third_party/nix/src/libutil/config.cc | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/third_party/nix/src/libutil/config.cc b/third_party/nix/src/libutil/config.cc index 83dbf8b6e54f..dbb703750f36 100644 --- a/third_party/nix/src/libutil/config.cc +++ b/third_party/nix/src/libutil/config.cc @@ -11,7 +11,9 @@ namespace nix { bool Config::set(const std::string& name, const std::string& value) { auto i = _settings.find(name); - if (i == _settings.end()) return false; + if (i == _settings.end()) { + return false; + } i->second.setting->set(value); i->second.setting->overriden = true; return true; @@ -84,10 +86,14 @@ void AbstractConfig::applyConfigFile(const Path& path) { pos++; string::size_type hash = line.find('#'); - if (hash != string::npos) line = string(line, 0, hash); + if (hash != string::npos) { + line = string(line, 0, hash); + } vector<string> tokens = tokenizeString<vector<string> >(line); - if (tokens.empty()) continue; + if (tokens.empty()) { + continue; + } if (tokens.size() < 2) throw UsageError("illegal configuration line '%1%' in '%2%'", line, @@ -147,7 +153,9 @@ void Config::toJSON(JSONObject& out) { void Config::convertToArgs(Args& args, const std::string& category) { for (auto& s : _settings) - if (!s.second.isAlias) s.second.setting->convertToArg(args, category); + if (!s.second.isAlias) { + s.second.setting->convertToArg(args, category); + } } AbstractSetting::AbstractSetting(const std::string& name, @@ -284,7 +292,9 @@ void PathSetting::set(const std::string& str) { bool GlobalConfig::set(const std::string& name, const std::string& value) { for (auto& config : *configRegistrations) - if (config->set(name, value)) return true; + if (config->set(name, value)) { + return true; + } unknownSettings.emplace(name, value); @@ -315,7 +325,9 @@ GlobalConfig globalConfig; GlobalConfig::ConfigRegistrations* GlobalConfig::configRegistrations; GlobalConfig::Register::Register(Config* config) { - if (!configRegistrations) configRegistrations = new ConfigRegistrations; + if (!configRegistrations) { + configRegistrations = new ConfigRegistrations; + } configRegistrations->emplace_back(config); } |