Use unwrap_or() instead of match block; remove unused import
This commit is contained in:
1 parent
7a3ed2ba02
commit
82e2ec3fbd
1 file changed
+1
-5
+1
-5
@@ -1,6 +1,5 @@
|
||||
use clap::Parser;
|
||||
use crossterm::terminal::size;
|
||||
use std::env;
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
|
||||
mod mikuart;
|
||||
@@ -21,10 +20,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let args = Args::parse();
|
||||
|
||||
let text = args.text;
|
||||
let style = match args.style {
|
||||
Some(s) => s,
|
||||
None => -1, // Default to -1 to select a random style
|
||||
};
|
||||
let style = args.style.unwrap_or(-1); // Default to -1 to select a random style
|
||||
draw_miku_says(&text, style)?;
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in new issue
Block a user