This commit is contained in:
greg 2018-05-01 18:10:24 -07:00
parent 061d54702f
commit fe64cbcd3a

View File

@ -298,19 +298,16 @@ impl Repl {
Some(s) => s.to_string(), Some(s) => s.to_string(),
None => return Some(format!("Must specify a stage to debug")), None => return Some(format!("Must specify a stage to debug")),
}; };
let maybe_debug = stages.iter().find(|stage_name| **stage_name == debug_stage); if let Some(stage) = stages.iter().find(|stage_name| **stage_name == debug_stage) {
match (show, maybe_debug) { let msg = format!("{} debug for stage {}", if show { "Enabling" } else { "Disabling" }, debug_stage);
(true, Some(s)) => { if show {
let msg = format!("Enabling debug for stage {}", debug_stage);
self.options.debug_stages.insert(debug_stage); self.options.debug_stages.insert(debug_stage);
Some(msg) } else {
},
(false, Some(s)) => {
let msg = format!("Disabling debug for stage {}", debug_stage);
self.options.debug_stages.remove(&debug_stage); self.options.debug_stages.remove(&debug_stage);
Some(msg) }
}, Some(msg)
(_, None) => Some(format!("couldn't find it")) } else {
Some(format!("Couldn't find stage: {}", debug_stage))
} }
}, },
_ => Some(format!("Unknown debug command")) _ => Some(format!("Unknown debug command"))