Skip to content

Commit

Permalink
add must_use attribute for EventBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
laizy committed Apr 17, 2020
1 parent 612440c commit 6d4ea98
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ontio-std/src/abi/event_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const TYPE_H256: u8 = 0x05;

const TYPE_LIST: u8 = 0x10;
///Entity used to push events in a contract.
#[must_use = "this `EventBuilder` should call notify to take effect"]
pub struct EventBuilder {
sink: Sink,
num_entry: u32,
Expand Down Expand Up @@ -136,3 +137,13 @@ impl EventBuilder {
runtime::notify(&buf);
}
}

// compile-fails

/// ```compile_fail
/// #[deny(unused_must_use)]
/// {
/// EventBuilder::new().bool(true);
/// }
/// ```
fn _event_builder_must_use() {}

0 comments on commit 6d4ea98

Please sign in to comment.