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

feat: add standard derives to all public types #505

Merged
merged 4 commits into from Dec 13, 2022

Conversation

TheLostLambda
Copy link
Contributor

@TheLostLambda TheLostLambda commented Oct 1, 2022

Implement Rust API Guidelines C-COMMON-TRAITS and C-SERDE

In working with Rust bio, I needed to fork the project in order to serialize some public types like Orf. Missing derive implementations is a common problem I seem to encounter when working with many crates, so I took the afternoon to add every recommended trait (#[derive(Default, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Serialize, Deserialize)]) to every pub struct and pub enum in the crate using a script, then I sat down to sort out the compiler issues.

If derives failed because a private rust-bio type didn't implement a certain trait, then derives for those traits were added to private types until they compiled. For derives failing because types outside of rust-bio don't implement a trait, those derives were removed until the code compiled.

After adding all of those derives, I also cleaned up a few clippy lints in the second commit. Adding some of those Copy derives meant a lot of calls to Clone could be removed!

Sorry this looks like a massive change! Should be relatively trivial to review though, since it should only be adding derives and not touching anything more complex.

@TheLostLambda TheLostLambda changed the title Implement Rust API Guidelines C-COMMON-TRAITS and C-SERDE feat: add standard derives to all public types Oct 1, 2022
@TheLostLambda
Copy link
Contributor Author

Oh, and sorry for that messy looking commit history! I assume you'll squash things, but a lot of those commits were me re-syncing my fork with your master branch before starting this work. Only the last two commits should actually contain any changes!

@coveralls
Copy link

coveralls commented Oct 1, 2022

Coverage Status

Coverage decreased (-0.01%) to 88.38% when pulling e087b05 on TheLostLambda:main into f73cab7 on rust-bio:master.

@TheLostLambda
Copy link
Contributor Author

As far as I can tell, @coveralls might just be confused by the changing of formatting from adding the derives! I don't see any other way coverage has changed!

benches/pairhmm.rs Outdated Show resolved Hide resolved
@natir
Copy link
Contributor

natir commented Oct 4, 2022

Hello @TheLostLambda,

Thank for this pull request and for discover of Rust API Guidelines.

Except some not required change in benchmark, this pull request seems good. I run a benchmark to check if change have an impact on computation time, moreover so noise in benchmark, it's seems this pull request didn't have any impact on runtime.

@TheLostLambda the lost of 0.01% of code coverage isn't realy important.

Before merge you could probably rebase your commit on top of rust-bio change ? @rust-bio/mergers I think this pull request is ready to merge.

Copy link
Contributor

@natir natir left a comment

Choose a reason for hiding this comment

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

It's good for me

@TheLostLambda
Copy link
Contributor Author

Could I poke @johanneskoester about getting this merged? I'd also be quite keen in joining the mergers team in the future! There is a lot of work with this library in my future and it would be great if could get a bit more involved in its maintenance!

Thanks a ton and sorry for pestering!

@johanneskoester
Copy link
Contributor

Awesome @TheLostLambda! Thanks a lot!

  1. Yes, at any time, feel free to contact me via mail or discord. Github notifications are a problem for me, because I get far too many via Bioconda and Snakemake.
  2. And yes, I am now immediately including you into the mergers team. Welcome!

@johanneskoester johanneskoester merged commit c08623b into rust-bio:master Dec 13, 2022
@johanneskoester
Copy link
Contributor

You have an invite!

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