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

"cargo doc" contains untested examples #3

Open
loloicci opened this issue May 29, 2024 · 0 comments
Open

"cargo doc" contains untested examples #3

loloicci opened this issue May 29, 2024 · 0 comments

Comments

@loloicci
Copy link
Contributor

loloicci commented May 29, 2024

cw-into-event/src/lib.rs

Lines 51 to 83 in a713482

/// Structure:
///
/// ```ignore
/// #[derive(IntoEvent)]
/// struct MyStruct {
/// field1: type1,
/// // if the value's type does not implement `Into<String>` trait
/// // and it implements `ToString` trait, programmers can specify
/// // to use `field1.to_string()` to get string
/// // by applying `use_to_string`.
/// #[use_to_string]
/// field2: type2,
/// // if the value's type does not implement both `Into<String>` and
/// // `ToString` traits, programmers need specify a function
/// // to get string with `casting_fn(field3)` by applying
/// // `to_string_fn(casting_fn)` attribute.
/// // this `casting_fn` needs to have the type `type3 -> String`.
/// #[to_string_fn(casting_fn)]
/// field3: type3,
/// }
/// ```
///
/// Output AST:
///
/// ```ignore
/// impl Into<cosmwasm_std::Event> for MyStruct {
/// fn into(self) -> cosmwasm_std::Event {
/// cosmwasm_std::Event::new("my_struct")
/// .add_attribute("field1", self.field1)
/// .add_attribute("field2", self.field2.to_string())
/// .add_attribute("field3", casting_fn(self.field3))
/// }
/// }

These examples are specified as ignore and issue warnings in the doc.

Screenshot 2024-05-29 at 10 49 34

As #2 (comment), I think there is no problem, but should write why this has warnings.

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

No branches or pull requests

1 participant