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

fix rename or remove #2276

Merged
merged 1 commit into from
Feb 9, 2023
Merged

Conversation

wolfv
Copy link
Member

@wolfv wolfv commented Feb 9, 2023

This fixes the usage of the confusing ec boolean values :)

It would be much nicer if the error_code had a has_error() function to make it easier to understand what we're testing.

Maybe @JohanMabille or @Klaim can give this a review to make sure it's correct this time around.

@JohanMabille
Copy link
Member

I agree that it's a bit too close to the C error code mechanism.

Comment on lines +154 to +155
std::error_code ec2;
fs::remove(to, ec2);
Copy link
Member

Choose a reason for hiding this comment

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

Not so familiar with error code, but shouldn't we not checking the result here?

Copy link
Member Author

Choose a reason for hiding this comment

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

we don't really care about the result because at this point the operation has already failed.

Copy link
Member

Choose a reason for hiding this comment

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

Adding [[maybe_unused]] here would clarify that and avoid warnings.

Copy link
Member

@Klaim Klaim left a comment

Choose a reason for hiding this comment

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

LGTM

I wish it was testable in some ways...

@JohanMabille JohanMabille merged commit 6009a91 into mamba-org:main Feb 9, 2023
@Klaim
Copy link
Member

Klaim commented Feb 9, 2023

It would be much nicer if the error_code had a has_error() function to make it easier to understand what we're testing.

I remember people in Boost and C++ committee agreeing with you (and adding some other issues with boost/std::error_code) and planning for an alternative which would have a better interface, but it's note in the standard (yet) and I dont know where the effort ended up. But yeah it's among the known and agreed issues.

@wolfv wolfv deleted the fix_rename_or_move branch February 9, 2023 13:21
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.

None yet

4 participants