Skip to content

simplify many match - #13801

Open
oech3 wants to merge 1 commit into
uutils:mainfrom
oech3:fmt-ret-err
Open

simplify many match#13801
oech3 wants to merge 1 commit into
uutils:mainfrom
oech3:fmt-ret-err

Conversation

@oech3

@oech3 oech3 commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/date/date-locale-hour (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tail/tail-n0f (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/tail/symlink (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/seq/seq-epipe is now being skipped but was previously passing.
Note: The gnu test tests/misc/write-errors was skipped on 'main' but is now failing.

Comment thread src/uu/chgrp/src/chgrp.rs
Comment on lines +69 to +76
parse_gid_from_str(from_group)
.map(IfFrom::Group)
.map_err(|_| {
USimpleError::new(
1,
translate!("chgrp-error-invalid-user", "from_group" => from_group),
));
}
}
)
})?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I prefer let-else over map_err with an intentional ignore:

Suggested change
parse_gid_from_str(from_group)
.map(IfFrom::Group)
.map_err(|_| {
USimpleError::new(
1,
translate!("chgrp-error-invalid-user", "from_group" => from_group),
));
}
}
)
})?
let Ok(g) = parse_gid_from_str(from_group) else {
return Err(USimpleError::new(
1,
translate!("chgrp-error-invalid-user", "from_group" => from_group),
));
};
IfFrom::Group(g)

In this case, the if could also be collapsed into a let-chain.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thiserror could be used for that too, something like #13620

@codspeed-hq

codspeed-hq Bot commented Aug 8, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 3.39%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 1 regressed benchmark
✅ 346 untouched benchmarks
⏩ 46 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation numfmt_to_si_precision[10000] 90.6 ms 93.8 ms -3.39%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing oech3:fmt-ret-err (548f9a2) with main (5d75e5e)

Open in CodSpeed

Footnotes

  1. 46 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.

@sylvestre

Copy link
Copy Markdown
Contributor

Please ping me when it is ready

@oech3

oech3 commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

Please ping me when it is ready

ready (CI is passing).

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.

4 participants