1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-22 18:29:36 +01:00

Apply clang-format universally.

* It is tough to contribute to a project that doesn't use a formatter,
* It is extra hard to contribute to a project which has configured the formatter, but ignores it for some files
* Code formatting makes it harder to hide obscure / weird bugs by accident or on purpose,

Let's rip the bandaid off?

Note that PRs currently in flight should be able to be merged relatively easily by applying `clang-format` to their tip prior to merge.
This commit is contained in:
Graham Christensen 2025-07-18 12:47:27 -04:00
parent 41bf87ec70
commit e4f62e4608
587 changed files with 23258 additions and 23135 deletions

View file

@ -4,12 +4,10 @@
#include <iostream>
using std::cout;
namespace nix {
static inline std::string_view xmlQuote(std::string_view s)
{
// Luckily, store paths shouldn't contain any character that needs to be
@ -17,20 +15,16 @@ static inline std::string_view xmlQuote(std::string_view s)
return s;
}
static std::string symbolicName(std::string_view p)
{
return std::string(p.substr(0, p.find('-') + 1));
}
static std::string makeEdge(std::string_view src, std::string_view dst)
{
return fmt(" <edge source=\"%1%\" target=\"%2%\"/>\n",
xmlQuote(src), xmlQuote(dst));
return fmt(" <edge source=\"%1%\" target=\"%2%\"/>\n", xmlQuote(src), xmlQuote(dst));
}
static std::string makeNode(const ValidPathInfo & info)
{
return fmt(
@ -45,7 +39,6 @@ static std::string makeNode(const ValidPathInfo & info)
(info.path.isDerivation() ? "derivation" : "output-path"));
}
void printGraphML(ref<Store> store, StorePathSet && roots)
{
StorePathSet workList(std::move(roots));
@ -65,7 +58,8 @@ void printGraphML(ref<Store> store, StorePathSet && roots)
auto path = std::move(workList.extract(workList.begin()).value());
ret = doneSet.insert(path);
if (ret.second == false) continue;
if (ret.second == false)
continue;
auto info = store->queryPathInfo(path);
cout << makeNode(*info);
@ -76,12 +70,10 @@ void printGraphML(ref<Store> store, StorePathSet && roots)
cout << makeEdge(path.to_string(), p.to_string());
}
}
}
cout << "</graph>\n";
cout << "</graphml>\n";
}
}
} // namespace nix