fix logic for logging step 5, output should now trigger two errors in a row

This commit is contained in:
Nathan Stocks
2022-02-20 14:20:49 -07:00
parent 2129073c03
commit a47afbbb6e
2 changed files with 3 additions and 1 deletions

View File

@@ -26,8 +26,9 @@ impl Frog {
} }
} }
pub fn sleep(&mut self) { pub fn sleep(&mut self) {
if !self.sleeping { if self.sleeping {
// 5. Use error!() to log a (non-fatal) error stating that the Frog is already asleep // 5. Use error!() to log a (non-fatal) error stating that the Frog is already asleep
} else {
self.sleeping = true; self.sleeping = true;
} }
} }

View File

@@ -19,6 +19,7 @@ fn main() {
skippy.hop(); skippy.hop();
skippy.hop(); skippy.hop();
skippy.sleep(); skippy.sleep();
skippy.sleep();
// Challenge: Go back to lib.rs and set the `target: ` argument for each logging call to be the // Challenge: Go back to lib.rs and set the `target: ` argument for each logging call to be the
// path to the function. For example, `Frog::new` // path to the function. For example, `Frog::new`