diff --git a/src/main.rs b/src/main.rs index 4673916..14ba9af 100644 --- a/src/main.rs +++ b/src/main.rs @@ -115,9 +115,9 @@ fn main() prisoners.push(prisoner_i); } - // if any prisoner has not found their number if !opts.json { + // if any prisoner has not found their number if prisoners.iter().any(|i| !i.found) { println!("failure"); @@ -129,6 +129,7 @@ fn main() } else { + // export data to JSON format let out_json = serde_json::to_string(&prisoners).unwrap(); println!("{}", out_json); }