Skip to content

chore: apply Clippy suggestions and improve code formatting#10691

Open
nyurik wants to merge 4 commits intouutils:mainfrom
nyurik:clippy
Open

chore: apply Clippy suggestions and improve code formatting#10691
nyurik wants to merge 4 commits intouutils:mainfrom
nyurik:clippy

Conversation

@nyurik
Copy link
Contributor

@nyurik nyurik commented Feb 3, 2026

@github-actions
Copy link

github-actions bot commented Feb 3, 2026

GNU testsuite comparison:

Skip an intermittent issue tests/tail/follow-name (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/shuf/shuf-reservoir (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/sort/sort-stale-thread-mem (passes in this run but fails in the 'main' branch)

@github-actions
Copy link

github-actions bot commented Feb 4, 2026

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/inotify-dir-recreate (passes in this run but fails in the 'main' branch)

@nyurik nyurik force-pushed the clippy branch 2 times, most recently from 7489d4f to adb143f Compare February 4, 2026 08:23
@codspeed-hq
Copy link

codspeed-hq bot commented Feb 4, 2026

Merging this PR will not alter performance

✅ 284 untouched benchmarks
⏩ 38 skipped benchmarks1


Comparing nyurik:clippy (f16d610) with main (e7f8247)2

Open in CodSpeed

Footnotes

  1. 38 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on main (9254531) during the generation of this report, so e7f8247 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@github-actions
Copy link

github-actions bot commented Feb 4, 2026

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/follow-name (passes in this run but fails in the 'main' branch)

@xtqqczze
Copy link
Contributor

xtqqczze commented Feb 4, 2026

@nyurik I've been fixing some clippy lints, I usually stick to 1 lint per PR for ease of review

@nyurik
Copy link
Contributor Author

nyurik commented Feb 4, 2026

@xtqqczze thx, makes sense. I moved a big number formatting change into #10717 making this PR only 50 line changes - hopefully makes it much easier to review

@github-actions
Copy link

github-actions bot commented Feb 4, 2026

GNU testsuite comparison:

Skip an intermittent issue tests/shuf/shuf-reservoir (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/sort/sort-stale-thread-mem (fails in this run but passes in the 'main' branch)

}
}

#[expect(clippy::unnested_or_patterns)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please document "why"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add a comment - but the extended version: this is what it would look like after optimization -- i don't think it's as readable

        [b'l' | b'r' | b'e', b'c']
            | [b'r', b's']
            | [b'n' | b's' | b'd', b'o']
            | [b'f' | b'd' | b'p' | b'm', b'i']
            | [b'l', b'n']
            | [b'b' | b'c', b'd']
            | [b'o', b'r' | b'w']
            | [b'e', b'x']
            | [b's', b'u' | b'g' | b't']
            | [b't', b'w']
            | [b'c', b'a' | b'l']
            | [b'm', b'h']

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed :)

let mut formatted_possible_values = String::new();
for (i, s) in possible_values.iter().enumerate() {
formatted_possible_values.push_str(&format!("'{}'", s.get_name()));
let _ = write!(formatted_possible_values, "'{}'", s.get_name());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems unrelated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is part of the clippy::format_push_string -- clippy warns without this change

@github-actions
Copy link

github-actions bot commented Feb 4, 2026

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tail/inotify-dir-recreate (passes in this run but fails in the 'main' branch)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants