Implement Arbitrary directly on types where possible #3350
Conversation
@@ -15,6 +15,8 @@ | |||
#![type_length_limit = "1049479"] // Regressed with Rust 1.46.0 :( | |||
|
|||
pub mod actions; | |||
#[cfg(feature = "quickcheck")] |
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.
As this is test code I would expect it to be behind cfg(test)
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.
If it is behind cfg(test)
, you cannot use it from a different crate. It is quite common for library crates to expose such implementations under the feature-flag of the library that enables them. It is similar to how implementations of serde::Serialize
are exposed under a serde
feature flag.
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.
If it is behind cfg(test), you cannot use it from a different crate.
Can you clarify how it is behind cfg(test)
?
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 isn't. If it were, then all consumers of the comit
crate would not be able to use the functions in this module. This is the comit crate in case you didn't notice :)
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.
Are you saying that we don't need to expose this module publicly because neither cnd
nor nectar
are currently using the functions in this module?
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.
Ok, thinking about it. It's fine the way it is :)
ab50fd0
to
4e5c1c1
Compare
c201de8
to
b7391ea
Compare
4e5c1c1
to
43dc16f
Compare
b7391ea
to
26a5d52
Compare
With the introduction swap execution in the comit lib, we also introduced a dependency on quickcheck. Previously, a lot of the `Arbitrary` impls where defined within nectar. We can now move them to the `comit` lib.
bors r+ |
Build succeeded: |
With the introduction swap execution in the comit lib, we also
introduced a dependency on quickcheck. Previously, a lot of the
Arbitrary
impls where defined within nectar. We can now movethem to the
comit
lib.