From d02a206940453cb96a4424baab93c0f13fef8b48 Mon Sep 17 00:00:00 2001 From: Viktor Gustavsson Date: Sat, 22 Mar 2025 14:27:37 +0100 Subject: [PATCH] Fix `clippy::unnecessary-literal-unwrap` in `bevy_time` (#18485) # Objective - Compiling `bevy_time` without the `std`-feature results in a `clippy::unnecessary-literal-unwrap`. ## Solution - Fix lint error ## Testing - CI --- --- crates/bevy_time/src/lib.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/bevy_time/src/lib.rs b/crates/bevy_time/src/lib.rs index db39a41929..d2648e6fd8 100644 --- a/crates/bevy_time/src/lib.rs +++ b/crates/bevy_time/src/lib.rs @@ -160,12 +160,13 @@ pub fn time_system( None => None, }; - #[cfg(not(feature = "std"))] - let sent_time = None; - match update_strategy.as_ref() { TimeUpdateStrategy::Automatic => { + #[cfg(feature = "std")] real_time.update_with_instant(sent_time.unwrap_or_else(Instant::now)); + + #[cfg(not(feature = "std"))] + real_time.update_with_instant(Instant::now()); } TimeUpdateStrategy::ManualInstant(instant) => real_time.update_with_instant(*instant), TimeUpdateStrategy::ManualDuration(duration) => real_time.update_with_duration(*duration),