aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-07-17 04:18:27 +0800
committer魏曹先生 <1992414357@qq.com>2026-07-17 04:18:27 +0800
commit21b1872871a2af6483bfe8667749a9d3197b45de (patch)
tree5c1c3e383ab92f448f86268d7508ccad3b00a070
parentab803966fedb640fedc95e22259e09b2922b22a0 (diff)
feat(mingling, mingling_picker): add feature constants and fixHEADunreleasedmain
formatting Add `MINGLING_CORE` and `MINGLING_MACROS` feature flag constants to the mingling crate, mirroring existing pattern for other features Reorganize imports and reformat closures in mingling_picker for consistent style
-rw-r--r--mingling/src/features.rs22
-rw-r--r--mingling_picker/src/parselib/multi_arg_matcher.rs8
-rw-r--r--mingling_picker/src/pickable/multi_pickable.rs3
3 files changed, 27 insertions, 6 deletions
diff --git a/mingling/src/features.rs b/mingling/src/features.rs
index 32ca5de..cb474ae 100644
--- a/mingling/src/features.rs
+++ b/mingling/src/features.rs
@@ -53,6 +53,17 @@ pub const MINGLING_COMP: bool = false;
#[cfg(feature = "comp")]
#[allow(unused)]
pub const MINGLING_COMP: bool = true;
+/// Whether the `core` feature is enabled
+/// Current: `disabled`
+#[cfg(not(feature = "core"))]
+#[allow(unused)]
+pub const MINGLING_CORE: bool = false;
+
+/// Whether the `core` feature is enabled
+/// Current: `enabled`
+#[cfg(feature = "core")]
+#[allow(unused)]
+pub const MINGLING_CORE: bool = true;
/// Whether the `debug` feature is enabled
/// Current: `disabled`
#[cfg(not(feature = "debug"))]
@@ -108,6 +119,17 @@ pub const MINGLING_JSON_SERDE_FMT: bool = false;
#[cfg(feature = "json_serde_fmt")]
#[allow(unused)]
pub const MINGLING_JSON_SERDE_FMT: bool = true;
+/// Whether the `macros` feature is enabled
+/// Current: `disabled`
+#[cfg(not(feature = "macros"))]
+#[allow(unused)]
+pub const MINGLING_MACROS: bool = false;
+
+/// Whether the `macros` feature is enabled
+/// Current: `enabled`
+#[cfg(feature = "macros")]
+#[allow(unused)]
+pub const MINGLING_MACROS: bool = true;
/// Whether the `nightly` feature is enabled
/// Current: `disabled`
#[cfg(not(feature = "nightly"))]
diff --git a/mingling_picker/src/parselib/multi_arg_matcher.rs b/mingling_picker/src/parselib/multi_arg_matcher.rs
index e8bdb71..748b1be 100644
--- a/mingling_picker/src/parselib/multi_arg_matcher.rs
+++ b/mingling_picker/src/parselib/multi_arg_matcher.rs
@@ -65,9 +65,8 @@ impl Matcher for MultiArgMatcher {
let possible_flags = build_possible_flags(style, arg_info);
let end = seek_end_of_options(args, style);
let sep = style.value_separator;
- let is_flag = |raw: &str| {
- raw.starts_with(style.long_prefix) || raw.starts_with(style.short_prefix)
- };
+ let is_flag =
+ |raw: &str| raw.starts_with(style.long_prefix) || raw.starts_with(style.short_prefix);
let is_our_flag = |raw: &str| {
possible_flags
.iter()
@@ -118,7 +117,8 @@ impl Matcher for MultiArgMatcher {
impl MultiArgMatcher {
#[inline(always)]
fn flag_match(raw: &str, flag_str: &str, case_sensitive: bool, sep: char) -> bool {
- let eq = |r: &str, f: &str| r.len() > f.len() && r.as_bytes().get(f.len()) == Some(&(sep as u8));
+ let eq =
+ |r: &str, f: &str| r.len() > f.len() && r.as_bytes().get(f.len()) == Some(&(sep as u8));
if case_sensitive {
raw == flag_str || (raw.starts_with(flag_str) && eq(raw, flag_str))
diff --git a/mingling_picker/src/pickable/multi_pickable.rs b/mingling_picker/src/pickable/multi_pickable.rs
index 0ab0508..84a8068 100644
--- a/mingling_picker/src/pickable/multi_pickable.rs
+++ b/mingling_picker/src/pickable/multi_pickable.rs
@@ -1,8 +1,7 @@
use crate::{
+ Pickable, PickerArg, PickerArgAttr, PickerArgResult, SinglePickable, TagPhaseContext,
matcher_needed::Matcher,
parselib::{MultiArgMatcher, ParserStyle},
- Pickable, PickerArg, PickerArgAttr, PickerArgResult,
- SinglePickable, TagPhaseContext,
};
/// Boundary check for multi-value positional parameters.