File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -213,17 +213,17 @@ fn process(
213
213
// Let's do a sanity check before going forward.
214
214
let _ = chalk_prog. db . checked_program ( ) ?;
215
215
* prog = Some ( chalk_prog) ;
216
- } else if command. starts_with ( "load " ) {
216
+ } else if let Some ( filename ) = command. strip_prefix ( "load " ) {
217
217
// Load a .chalk file.
218
- let filename = & command[ "load " . len ( ) ..] ;
219
218
let chalk_prog = load_program ( args, filename) ?;
220
219
// Let's do a sanity check before going forward.
221
220
let _ = chalk_prog. db . checked_program ( ) ?;
222
221
* prog = Some ( chalk_prog) ;
223
- } else if command. starts_with ( "debug " ) {
224
- match command. split_whitespace ( ) . nth ( 1 ) {
225
- Some ( level) => std:: env:: set_var ( "CHALK_DEBUG" , level) ,
226
- None => println ! ( "debug <level> set debug level to <level>" ) ,
222
+ } else if let Some ( level) = command. strip_prefix ( "debug " ) {
223
+ if level. is_empty ( ) {
224
+ println ! ( "debug <level> set debug level to <level>" ) ;
225
+ } else {
226
+ std:: env:: set_var ( "CHALK_DEBUG" , level) ;
227
227
}
228
228
} else {
229
229
// The command is either "print", "lowered", or a goal.
You can’t perform that action at this time.
0 commit comments