Cleanup pass over llvm::seq uses (#5185)

I was thinking about this after `seq` changes in #5182, and looked for
other uses that might be replaceable. Here's the resulting cleanup
around `seq`:

- Switch to `enumerate` or `zip` when possible.
- `int _` -> `auto _` (it's typically a `size_t`, but there's no reason
to cast when unused)
- Fix a case of cast style `(size_t)...` -> `static_cast<size_t>(...)`
- Switch `(void)close_children_count` to `[[maybe_unused]]`
This commit is contained in:
Jon Ross-Perkins
2025-03-26 19:25:03 +00:00
committed by GitHub
parent acbe6530c3
commit 0d3d829478
9 changed files with 37 additions and 40 deletions
+2 -2
View File
@@ -1034,7 +1034,7 @@ TEST_F(LexerTest, TypeLiteralTooManyDigits) {
// A 128-bit APInt should be plenty large, but if needed in the future it can
// be widened without issue.
llvm::APInt bits = llvm::APInt::getZero(128);
for ([[maybe_unused]] int _ : llvm::seq(1, 30)) {
for ([[maybe_unused]] auto _ : llvm::seq(1, 30)) {
code.append("9");
bits = bits * 10 + 9;
auto [buffer, value_stores] =
@@ -1160,7 +1160,7 @@ TEST_F(LexerTest, DiagnosticFileTooLarge) {
static constexpr size_t NumLines = 10'000'000;
std::string input;
input.reserve(NumLines * 3);
for ([[maybe_unused]] int _ : llvm::seq(NumLines)) {
for ([[maybe_unused]] auto _ : llvm::seq(NumLines)) {
input += "{}\n";
}
EXPECT_CALL(consumer,