From a47afbbb6ec477547d83cdf8e80d2cf23a04fa20 Mon Sep 17 00:00:00 2001 From: Nathan Stocks Date: Sun, 20 Feb 2022 14:20:49 -0700 Subject: [PATCH] fix logic for logging step 5, output should now trigger two errors in a row --- exercise/logging/src/lib.rs | 3 ++- exercise/logging/src/main.rs | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/exercise/logging/src/lib.rs b/exercise/logging/src/lib.rs index 3b447f6..95475de 100644 --- a/exercise/logging/src/lib.rs +++ b/exercise/logging/src/lib.rs @@ -26,8 +26,9 @@ impl Frog { } } 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 + } else { self.sleeping = true; } } diff --git a/exercise/logging/src/main.rs b/exercise/logging/src/main.rs index c4f1161..4d03774 100644 --- a/exercise/logging/src/main.rs +++ b/exercise/logging/src/main.rs @@ -19,6 +19,7 @@ fn main() { skippy.hop(); skippy.hop(); skippy.sleep(); + skippy.sleep(); // 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`