From 793656e4d764a3566907c049e66a9ccf37b89f93 Mon Sep 17 00:00:00 2001 From: mgt Date: Tue, 7 May 2024 12:17:44 +0800 Subject: [PATCH] chore: fix clippy ci --- crates/mitex-cli/src/lib.rs | 10 +++++----- crates/mitex-lexer/src/snapshot_map.rs | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/mitex-cli/src/lib.rs b/crates/mitex-cli/src/lib.rs index 381a4f1..d961afb 100644 --- a/crates/mitex-cli/src/lib.rs +++ b/crates/mitex-cli/src/lib.rs @@ -200,11 +200,11 @@ fn process_opts(mut opts: Opts) -> Result { match io_args.len() { 0 => {} 1 => { - args.input = io_args[0].clone(); + args.input.clone_from(&io_args[0]); } 2 => { - args.input = io_args[0].clone(); - args.output = io_args[1].clone(); + args.input.clone_from(&io_args[0]); + args.output.clone_from(&io_args[1]); } _ => Err(clap::Error::raw( clap::error::ErrorKind::ValueValidation, @@ -226,7 +226,7 @@ fn process_opts(mut opts: Opts) -> Result { ))?; } if args.output.is_empty() { - args.output = std::path::Path::new(&args.input) + std::path::Path::new(&args.input) .with_extension("tex") .to_str() .ok_or_else(|| { @@ -235,7 +235,7 @@ fn process_opts(mut opts: Opts) -> Result { "Input file name is invalid.", ) })? - .to_owned(); + .clone_into(&mut args.output); } } diff --git a/crates/mitex-lexer/src/snapshot_map.rs b/crates/mitex-lexer/src/snapshot_map.rs index 0dc612f..748e604 100644 --- a/crates/mitex-lexer/src/snapshot_map.rs +++ b/crates/mitex-lexer/src/snapshot_map.rs @@ -93,10 +93,10 @@ where } } - pub fn get(&self, k: &Q) -> Option<&V> + pub fn get(&self, k: &Q) -> Option<&V> where K: Borrow, - Q: Hash + Eq, + Q: Hash + Eq + ?Sized, { self.map.borrow().get(k) }