@@ -148,9 +148,7 @@ where
148
148
///
149
149
/// If there has already been set a caller.
150
150
pub fn caller ( mut self , caller : T :: AccountId ) -> Self {
151
- if self . caller . is_some ( ) {
152
- panic ! ( "already has a caller" ) ;
153
- }
151
+ assert ! ( self . caller. is_none( ) , "already has a caller" ) ;
154
152
self . caller = Some ( caller) ;
155
153
self
156
154
}
@@ -161,9 +159,7 @@ where
161
159
///
162
160
/// If there has already been set a callee.
163
161
pub fn callee ( mut self , callee : T :: AccountId ) -> Self {
164
- if self . callee . is_some ( ) {
165
- panic ! ( "already has a callee" ) ;
166
- }
162
+ assert ! ( self . callee. is_none( ) , "already has a callee" ) ;
167
163
self . callee = Some ( callee) ;
168
164
self
169
165
}
@@ -174,9 +170,7 @@ where
174
170
///
175
171
/// If there has already been set provided gas.
176
172
pub fn gas ( mut self , gas : u64 ) -> Self {
177
- if self . gas . is_some ( ) {
178
- panic ! ( "already has provided gas" ) ;
179
- }
173
+ assert ! ( self . gas. is_none( ) , "already has provided gas" ) ;
180
174
self . gas = Some ( gas) ;
181
175
self
182
176
}
@@ -187,9 +181,10 @@ where
187
181
///
188
182
/// If there has already been set transferred value (endowment).
189
183
pub fn transferred_value ( mut self , transferred_value : T :: Balance ) -> Self {
190
- if self . transferred_value . is_some ( ) {
191
- panic ! ( "already has set transferred value (endowment)" ) ;
192
- }
184
+ assert ! (
185
+ self . transferred_value. is_none( ) ,
186
+ "already has set transferred value (endowment)"
187
+ ) ;
193
188
self . transferred_value = Some ( transferred_value) ;
194
189
self
195
190
}
@@ -200,9 +195,7 @@ where
200
195
///
201
196
/// If there has already been set call data.
202
197
pub fn call_data ( mut self , call_data : CallData ) -> Self {
203
- if self . call_data . is_some ( ) {
204
- panic ! ( "already has set call data" ) ;
205
- }
198
+ assert ! ( self . call_data. is_none( ) , "already has set call data" ) ;
206
199
self . call_data = Some ( call_data) ;
207
200
self
208
201
}
0 commit comments