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

Replace usage of derivative #7122

Closed
xlc opened this issue Jan 13, 2025 · 9 comments · Fixed by #7324
Closed

Replace usage of derivative #7122

xlc opened this issue Jan 13, 2025 · 9 comments · Fixed by #7324
Labels
C2-good-first-issue A task for a first time contributor to become familiar with the Polkadot-SDK. D0-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder. I4-refactor Code needs refactoring.

Comments

@xlc
Copy link
Contributor

xlc commented Jan 13, 2025

discovered in #7123 that derivative is buggy and unmaintained. See more at mcarton/rust-derivative#117

@gui1117
Copy link
Contributor

gui1117 commented Jan 13, 2025

At a first glance https://github.com/ModProg/derive-where seems solid

@xlc
Copy link
Contributor Author

xlc commented Jan 13, 2025

I am currently using https://github.com/magiclen/educe in #7123 and that works fine. Happy to change all the educe usage to derive-where if that's what we are going to use.

@bkchr bkchr added D0-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder. C2-good-first-issue A task for a first time contributor to become familiar with the Polkadot-SDK. I4-refactor Code needs refactoring. labels Jan 13, 2025
@gui1117
Copy link
Contributor

gui1117 commented Jan 13, 2025

both look good to me, educe seems slightly more widely used.

@bkchr
Copy link
Member

bkchr commented Jan 13, 2025

We should check which one is maintained more and then use that one.

@ethernomad
Copy link

derive_more has 97m downloads
derive_where has 5m
educe has 1m

@gui1117
Copy link
Contributor

gui1117 commented Jan 15, 2025

I don't see anything about declaring bounds in derive_more.

on crates.io:
educe: 16m all time, 3m recent
derive-where: 8m, 3m

@conr2d
Copy link
Contributor

conr2d commented Jan 24, 2025

IMO, the syntax of derive-where is a bit more straightforward compared to educe.

educe:

#[derive(Educe)]
#[educe(Clone)]
struct Foo;

derive-where:

#[derive_where(Clone)]
struct Foo;

@bkchr
Copy link
Member

bkchr commented Jan 24, 2025

Yeah that is true.

@conr2d you want to work on this? Maybe it is worth looking into derive-where.

@conr2d
Copy link
Contributor

conr2d commented Jan 24, 2025

@bkchr Yup. I submitted PR replacing derivative with derive-where. Let me know if it needs a different requirement or it is not necessary.

github-merge-queue bot pushed a commit that referenced this issue Jan 30, 2025
# Description

Close #7122.

This PR replaces the unmaintained `derivative` dependency with
`derive-where`.

## Integration

This PR doesn't change the public interfaces.

## Review Notes

The `derivative` crate, previously used to derive basic traits for
structs with generics or enums, is no longer actively maintained. It has
been replaced with the `derive-where` crate, which offers a more
straightforward syntax while providing the same features as
`derivative`.

---------

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
Ank4n pushed a commit that referenced this issue Feb 6, 2025
# Description

Close #7122.

This PR replaces the unmaintained `derivative` dependency with
`derive-where`.

## Integration

This PR doesn't change the public interfaces.

## Review Notes

The `derivative` crate, previously used to derive basic traits for
structs with generics or enums, is no longer actively maintained. It has
been replaced with the `derive-where` crate, which offers a more
straightforward syntax while providing the same features as
`derivative`.

---------

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C2-good-first-issue A task for a first time contributor to become familiar with the Polkadot-SDK. D0-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder. I4-refactor Code needs refactoring.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants