Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove crash! macro #7084

Merged
merged 1 commit into from
Jan 8, 2025
Merged

Remove crash! macro #7084

merged 1 commit into from
Jan 8, 2025

Conversation

saulvaldelvira
Copy link
Contributor

@saulvaldelvira saulvaldelvira commented Jan 6, 2025

Remove the crash! and crash_if_error! macros, as discussed in #5487 .

I've replaced all crash_if_err! macro calls, by changing the return type of the functions it was called on. Instead of returning T, they return UResult<T>.
This way, instead of crashing, we can propagate the error.

The prompt_yes! macro also used crash_if_err!. In this case, I've replaced that with a call to show_if_err!.

All test pass, except test_df::test_type_option_with_file, which already failed before the changes.

NOTE: This is my first time contributing. Hope I've done everything alright.

@cakebaker
Copy link
Contributor

Can you please run cargo fmt? The CI also complains about some doc links pointing to code you removed: https://github.com/uutils/coreutils/actions/runs/12641963814/job/35236266280?pr=7084

@saulvaldelvira
Copy link
Contributor Author

Can you please run cargo fmt? The CI also complains about some doc links pointing to code you removed: https://github.com/uutils/coreutils/actions/runs/12641963814/job/35236266280?pr=7084

Sorry, yesterday I forgot to run cargo fmt. I've fixed the formatting and removed the doc comments linking to the deleted macros.

@saulvaldelvira saulvaldelvira force-pushed the main branch 2 times, most recently from 543d94b to 03a325f Compare January 7, 2025 13:13
Copy link

github-actions bot commented Jan 7, 2025

GNU testsuite comparison:

Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

@@ -31,7 +31,6 @@
//! - From custom messages: [`crate::show_error!`]
//! - Print warnings: [`crate::show_warning!`]
//! - Terminate util execution
Copy link
Contributor

Choose a reason for hiding this comment

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

A detail:

Suggested change
//! - Terminate util execution

Copy link
Contributor Author

@saulvaldelvira saulvaldelvira Jan 7, 2025

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

@cakebaker cakebaker left a comment

Choose a reason for hiding this comment

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

With the exception of a minor detail it looks good :)

Copy link

github-actions bot commented Jan 7, 2025

GNU testsuite comparison:

Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

@cakebaker cakebaker merged commit 72bdee0 into uutils:main Jan 8, 2025
65 checks passed
@cakebaker
Copy link
Contributor

Thanks for your PR :)

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.

2 participants