From dc13fa58448b7e267fb0ba63427534127f76beca Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Wed, 24 Jun 2026 06:58:09 +0800 Subject: Move flag tests to separate module and clean up deref patterns --- mingling_core/src/comp/shell_ctx.rs | 2 +- mingling_core/src/comp/suggest.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'mingling_core/src/comp') diff --git a/mingling_core/src/comp/shell_ctx.rs b/mingling_core/src/comp/shell_ctx.rs index 9d84aa7..616eade 100644 --- a/mingling_core/src/comp/shell_ctx.rs +++ b/mingling_core/src/comp/shell_ctx.rs @@ -307,7 +307,7 @@ mod tests { fn test_try_from_flag_without_value() { let args = vec!["-F".to_string()]; let context = ShellContext::try_from(args).unwrap(); - assert!(matches!(context.shell_flag, ShellFlag::Other(ref s) if s == "")); + assert!(matches!(context.shell_flag, ShellFlag::Other(ref s) if s.is_empty())); } #[test] diff --git a/mingling_core/src/comp/suggest.rs b/mingling_core/src/comp/suggest.rs index 03842e1..bd5dea6 100644 --- a/mingling_core/src/comp/suggest.rs +++ b/mingling_core/src/comp/suggest.rs @@ -243,7 +243,7 @@ mod tests { #[test] fn test_deref_suggest() { let s: Suggest = ["hello"].into(); - let set: &BTreeSet = &*s; + let set: &BTreeSet = &s; assert_eq!(set.len(), 1); } @@ -354,7 +354,7 @@ mod tests { #[test] fn test_ord_by_suggest_text() { - let mut items = vec![ + let mut items = [ SuggestItem::new("z".to_string()), SuggestItem::new("a".to_string()), SuggestItem::new("m".to_string()), @@ -367,7 +367,7 @@ mod tests { #[test] fn test_ord_with_description() { - let mut items = vec![ + let mut items = [ SuggestItem::new_with_desc("z".to_string(), "zzz".to_string()), SuggestItem::new("a".to_string()), SuggestItem::new_with_desc("m".to_string(), "mmm".to_string()), -- cgit