@@ -331,6 +331,7 @@ impl Script {
331331 pub fn into_bytes ( self ) -> Vec < u8 > { self . 0 . into_vec ( ) }
332332
333333 /// Compute the P2SH output corresponding to this redeem script
334+ #[ must_use]
334335 pub fn to_p2sh ( & self ) -> Script {
335336 Builder :: new ( ) . push_opcode ( opcodes:: all:: OP_HASH160 )
336337 . push_slice ( & ScriptHash :: hash ( & self . 0 ) [ ..] )
@@ -340,6 +341,7 @@ impl Script {
340341
341342 /// Compute the P2WSH output corresponding to this witnessScript (aka the "witness redeem
342343 /// script")
344+ #[ must_use]
343345 pub fn to_v0_p2wsh ( & self ) -> Script {
344346 Builder :: new ( ) . push_int ( 0 )
345347 . push_slice ( & WScriptHash :: hash ( & self . 0 ) [ ..] )
@@ -741,6 +743,7 @@ impl Builder {
741743 /// Adds instructions to push an integer onto the stack. Integers are
742744 /// encoded as little-endian signed-magnitude numbers, but there are
743745 /// dedicated opcodes to push some small integers.
746+ #[ must_use]
744747 pub fn push_int ( self , data : i64 ) -> Builder {
745748 // We can special-case -1, 1-16
746749 if data == -1 || ( data >= 1 && data <= 16 ) {
@@ -759,11 +762,13 @@ impl Builder {
759762
760763 /// Adds instructions to push an integer onto the stack, using the explicit
761764 /// encoding regardless of the availability of dedicated opcodes.
765+ #[ must_use]
762766 pub fn push_scriptint ( self , data : i64 ) -> Builder {
763767 self . push_slice ( & build_scriptint ( data) )
764768 }
765769
766770 /// Adds instructions to push some arbitrary data onto the stack
771+ #[ must_use]
767772 pub fn push_slice ( mut self , data : & [ u8 ] ) -> Builder {
768773 // Start with a PUSH opcode
769774 match data. len ( ) as u64 {
@@ -793,6 +798,7 @@ impl Builder {
793798 }
794799
795800 /// Pushes a public key
801+ #[ must_use]
796802 pub fn push_key ( self , key : & PublicKey ) -> Builder {
797803 if key. compressed {
798804 self . push_slice ( & key. inner . serialize ( ) [ ..] )
@@ -802,6 +808,7 @@ impl Builder {
802808 }
803809
804810 /// Adds a single opcode to the script
811+ #[ must_use]
805812 pub fn push_opcode ( mut self , data : opcodes:: All ) -> Builder {
806813 self . 0 . push ( data. into_u8 ( ) ) ;
807814 self . 1 = Some ( data) ;
@@ -811,6 +818,7 @@ impl Builder {
811818 /// Adds an `OP_VERIFY` to the script, unless the most-recently-added
812819 /// opcode has an alternate `VERIFY` form, in which case that opcode
813820 /// is replaced. e.g. `OP_CHECKSIG` will become `OP_CHECKSIGVERIFY`.
821+ #[ must_use]
814822 pub fn push_verify ( mut self ) -> Builder {
815823 match self . 1 {
816824 Some ( opcodes:: all:: OP_EQUAL ) => {
0 commit comments