Skip to content

Commit

Permalink
add must_use attribute for EventBuilder (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
laizy authored Aug 31, 2020
1 parent fe00c82 commit 3b546f7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion ontio-std/src/abi/event_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub(crate) const TYPE_H256: u8 = 0x05;
pub(crate) 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 {
common: VmValueBuilderCommon,
}
Expand Down Expand Up @@ -167,3 +167,13 @@ impl VmValueBuilderCommon {
self.num_entry += 1;
}
}

// compile-fails

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

0 comments on commit 3b546f7

Please sign in to comment.