Skip to content

refactor: functional style for collect_option_display_aliases#382

Merged
KSXGitHub merged 2 commits intomasterfrom
copilot/analyze-commit-pull-378
Mar 28, 2026
Merged

refactor: functional style for collect_option_display_aliases#382
KSXGitHub merged 2 commits intomasterfrom
copilot/analyze-commit-pull-378

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 28, 2026

collect_option_display_aliases in src/usage_md.rs used a mutable Vec with imperative push loops — the same pattern that was already refactored away in src/man_page.rs::render_option_header_flag.

Side-effectful loops elsewhere in usage_md.rs (writing to out, early-returning on error) are left as-is.

@KSXGitHub
Copy link
Copy Markdown
Owner

Eh. Existing code is fine.

@KSXGitHub KSXGitHub closed this Mar 28, 2026
@KSXGitHub KSXGitHub deleted the copilot/analyze-commit-pull-378 branch March 28, 2026 23:33
@KSXGitHub KSXGitHub restored the copilot/analyze-commit-pull-378 branch March 28, 2026 23:40
@KSXGitHub KSXGitHub reopened this Mar 28, 2026
@KSXGitHub KSXGitHub requested a review from Copilot March 28, 2026 23:40
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors collect_option_display_aliases in src/usage_md.rs to use an iterator-chain approach, aligning the implementation style with the similar alias/flag rendering logic in src/man_page.rs.

Changes:

  • Replaced the mutable Vec + push/for loops with a chained iterator pipeline.
  • Uses Option::into_iter() + flatten() to uniformly handle optional alias lists.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 28, 2026

Performance Regression Reports

commit: 070a7ba

There are no regressions.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@KSXGitHub KSXGitHub marked this pull request as ready for review March 28, 2026 23:54
@KSXGitHub KSXGitHub merged commit 3d4c387 into master Mar 28, 2026
21 checks passed
@KSXGitHub KSXGitHub deleted the copilot/analyze-commit-pull-378 branch March 28, 2026 23:54
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