@@ -109,14 +109,17 @@ impl BootstrapCommand {
109
109
self
110
110
}
111
111
112
+ #[ must_use]
112
113
pub fn delay_failure ( self ) -> Self {
113
114
Self { failure_behavior : BehaviorOnFailure :: DelayFail , ..self }
114
115
}
115
116
117
+ #[ must_use]
116
118
pub fn fail_fast ( self ) -> Self {
117
119
Self { failure_behavior : BehaviorOnFailure :: Exit , ..self }
118
120
}
119
121
122
+ #[ must_use]
120
123
pub fn allow_failure ( self ) -> Self {
121
124
Self { failure_behavior : BehaviorOnFailure :: Ignore , ..self }
122
125
}
@@ -127,11 +130,13 @@ impl BootstrapCommand {
127
130
}
128
131
129
132
/// Capture all output of the command, do not print it.
133
+ #[ must_use]
130
134
pub fn capture ( self ) -> Self {
131
135
Self { stdout : OutputMode :: Capture , stderr : OutputMode :: Capture , ..self }
132
136
}
133
137
134
138
/// Capture stdout of the command, do not print it.
139
+ #[ must_use]
135
140
pub fn capture_stdout ( self ) -> Self {
136
141
Self { stdout : OutputMode :: Capture , ..self }
137
142
}
@@ -178,36 +183,43 @@ pub struct CommandOutput {
178
183
}
179
184
180
185
impl CommandOutput {
186
+ #[ must_use]
181
187
pub fn did_not_start ( ) -> Self {
182
188
Self { status : CommandStatus :: DidNotStart , stdout : vec ! [ ] , stderr : vec ! [ ] }
183
189
}
184
190
191
+ #[ must_use]
185
192
pub fn is_success ( & self ) -> bool {
186
193
match self . status {
187
194
CommandStatus :: Finished ( status) => status. success ( ) ,
188
195
CommandStatus :: DidNotStart => false ,
189
196
}
190
197
}
191
198
199
+ #[ must_use]
192
200
pub fn is_failure ( & self ) -> bool {
193
201
!self . is_success ( )
194
202
}
195
203
204
+ #[ must_use]
196
205
pub fn status ( & self ) -> Option < ExitStatus > {
197
206
match self . status {
198
207
CommandStatus :: Finished ( status) => Some ( status) ,
199
208
CommandStatus :: DidNotStart => None ,
200
209
}
201
210
}
202
211
212
+ #[ must_use]
203
213
pub fn stdout ( & self ) -> String {
204
214
String :: from_utf8 ( self . stdout . clone ( ) ) . expect ( "Cannot parse process stdout as UTF-8" )
205
215
}
206
216
217
+ #[ must_use]
207
218
pub fn stdout_if_ok ( & self ) -> Option < String > {
208
219
if self . is_success ( ) { Some ( self . stdout ( ) ) } else { None }
209
220
}
210
221
222
+ #[ must_use]
211
223
pub fn stderr ( & self ) -> String {
212
224
String :: from_utf8 ( self . stderr . clone ( ) ) . expect ( "Cannot parse process stderr as UTF-8" )
213
225
}
0 commit comments