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

Cleanup: Avoid using explicit into #199

Closed
wants to merge 1 commit into from
Closed

Cleanup: Avoid using explicit into #199

wants to merge 1 commit into from

Conversation

rkuris
Copy link
Collaborator

@rkuris rkuris commented Aug 17, 2023

I prefer Ok(whatever()?) to whatever().map_err(Into::into)

I prefer Ok(whatever()?) to whatever().map_err(Into::into)
Copy link
Contributor

@richardpringle richardpringle left a comment

Choose a reason for hiding this comment

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

... I really don't like Ok-wrapping. The way that the operations are read isn't linear the way map_err is.

@@ -900,8 +903,7 @@ impl Db {
&self.cfg.rev,
)
.unwrap(),
}
.into()
})
Copy link
Contributor

Choose a reason for hiding this comment

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

This is less flexible than the previous code. Now if you change the function signature, you have to change the function body. Whereas before, as long as From<Revision> is implemented for the new return type, the function body doesn't need to change.

I also just think the old code looks better.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

OK I'll toss this.

@rkuris rkuris closed this Aug 17, 2023
@rkuris rkuris deleted the rkuris/avoid-into branch August 17, 2023 17:58
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