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

Fix typos in arbitrary docs #1094

Merged
merged 1 commit into from
Oct 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions soroban-sdk/src/arbitrary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,16 @@ mod api {
/// Types that implement `SorabanArbitrary` have an associated "prototype"
/// type that implements [`Arbitrary`].
///
/// This exists partly that the prototype can be named like
/// This exists partly so that the prototype can be named like
///
/// ```ignore
/// fuzz_target!(|input: <Bytes as SorobanArbitrary>::Arbitrary| {
/// ...
/// ```
/// # macro_rules! fuzz_target {
/// # (|$data:ident: $dty: ty| $body:block) => { };
/// # }
/// # use soroban_sdk::{Address, Env, Vec, Bytes};
/// # use soroban_sdk::arbitrary::SorobanArbitrary;
/// fuzz_target!(|input: <Bytes as SorobanArbitrary>::Prototype| {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This line previously used the wrong associated type name. This change makes the example a doc-test so that can't happen again.

Copy link
Member

Choose a reason for hiding this comment

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

Ah this is very cool way to get that type checking while still not actually having to run the fuzzer in the test 👏🏻.

/// // ...
/// });
/// ```
// This also makes derivation of `SorobanArbitrary` for custom types easier
Expand Down