From a9d5943939261e27e58bcf5cacbb618a0f63e999 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Mon, 10 Aug 2026 15:49:31 +0800 Subject: refactor(core): improve code style and public API clarity Replace bool-based settings with enums, refine visibility and signatures, and standardize `Self` usage across the crate. - Introduce `ErrorOutput`, `RenderOutput`, `PanicSilence`, `Verbosity`, `ColorOutput`, and `ProgressOutput` enums for clearer configuration semantics - Make `GlobalResources`, `ProgramCell`, and `split_input`/`split_input_string` public - Change hook info parameters to accept references and `split_input_string` to take `&str` - Apply `Self` shorthand throughout implementations and add `#[must_use]` attributes where appropriate - Enable strict clippy lints with targeted allowances --- mingling_core/src/program.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'mingling_core/src/program.rs') diff --git a/mingling_core/src/program.rs b/mingling_core/src/program.rs index 11e1bbf..3c43cee 100644 --- a/mingling_core/src/program.rs +++ b/mingling_core/src/program.rs @@ -109,7 +109,7 @@ where /// Creates a new Program instance with the provided command-line arguments. pub fn new_with_args(args: impl Into) -> Self { - Program { + Self { collect: std::marker::PhantomData, args: args.into().into(), @@ -133,14 +133,14 @@ where /// # Panics /// /// Panics if the program has not been initialized yet. - pub fn this_program() -> &'static Program + pub fn this_program() -> &'static Self where C: 'static, { THIS_PROGRAM .get_raw() .unwrap() - .downcast_ref::>() + .downcast_ref::() .unwrap() } @@ -173,7 +173,7 @@ where /// # Returns /// /// The previous command-line arguments. - pub fn replace_args(&mut self, args: Vec) -> Vec { + pub const fn replace_args(&mut self, args: Vec) -> Vec { std::mem::replace(&mut self.args, args) } -- cgit