-
Notifications
You must be signed in to change notification settings - Fork 95
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
Make tests build #429
Make tests build #429
Conversation
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
src/lib.rs
Outdated
//! | ||
//! use parity_scale_codec::{Encode, Decode, Compact, HasCompact}; | ||
//! | ||
//! #[derive(Debug, PartialEq, Encode, Decode)] | ||
//! #[derive(Debug, PartialEq, DeriveEncode, DeriveDecode)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not happy with this. People will be confused on where DeriveEncode
is coming from.
https://users.rust-lang.org/t/how-to-document-optional-features-in-api-docs/64577/3 above the code example with feature = "derive"
would be really nice!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This auto-generated feature warning seems to only work on whole modules or types. Not on single doc lines, so i added:
#![cfg_attr(feature = "derive", doc = "```rust")]
#![cfg_attr(not(feature = "derive"), doc = "*(Only compiled with feature `derive`)*\n```ignore")]
To each example to not compile them without the feature. Works also on stable.
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It errors with a redefinition of Decode when the feature is disabled.
Instead of the macro import could you have renamed the trait import, or even brought it in without a name, e.g. use Decode as _
? But this is fine too.
Co-authored-by: Marcin S. <marcin@realemail.net>
I tried both, but the trait and the derive macro have the same name. So when i import the trait |
Tests do not build with only MEL feature as pointed out in #428 (review)
This standard pattern that is used multiple times in the code does not actually work:
It errors with a redefinition of
Decode
when the feature is disabled. I aliased them in the tests now toDeriveDecode
.It is a bit unfortunate that
parity_scale_codec::Decode
is both a trait and a derive macro, depending on the features.