From d3201fdf793dd920d3f8baa20355f510ba68a29d Mon Sep 17 00:00:00 2001 From: wangyiyang Date: Fri, 22 Mar 2024 10:56:25 +0800 Subject: [PATCH] Update: refactor code --- src/bin/firework/gen.rs | 2 +- src/bin/firework/main.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/firework/gen.rs b/src/bin/firework/gen.rs index 6fd4591..90177fa 100644 --- a/src/bin/firework/gen.rs +++ b/src/bin/firework/gen.rs @@ -5,7 +5,7 @@ use glam::Vec2; use rand::{seq::IteratorRandom, thread_rng, Rng}; pub fn dyn_gen(fm: &mut FireworkManager, width: u16, height: u16, enable_gradient: bool) { - let colors = vec![ + let colors = [ vec![ (255, 102, 75), (144, 56, 67), diff --git a/src/bin/firework/main.rs b/src/bin/firework/main.rs index 9123b62..8dada84 100644 --- a/src/bin/firework/main.rs +++ b/src/bin/firework/main.rs @@ -33,7 +33,7 @@ fn main() -> Result<()> { let mut is_running = true; let cli = Cli::parse(); if let Some(f) = cli.fps { - if f < 5 || f > 30 { + if !(5..=30).contains(&f) { return Err(Error::new( std::io::ErrorKind::Other, "Invalid fps value! Valid fps range: 5~30",