From 1c065ed5ec1c1036d185dea91b2f0394d9ddd111 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Mon, 10 Aug 2026 16:21:51 +0800 Subject: refactor: use `Self` and simplify lifetimes in setup types Replace `ThisProgram` with `Self` where appropriate and mark constructors as `#[must_use]` and `const` where possible. Simplify explicit lifetimes in `ProgramSetup` and `Default` implementations using elided lifetimes. --- mingling/src/gen_program.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'mingling/src/gen_program.rs') diff --git a/mingling/src/gen_program.rs b/mingling/src/gen_program.rs index ef32074..90860b6 100644 --- a/mingling/src/gen_program.rs +++ b/mingling/src/gen_program.rs @@ -184,7 +184,7 @@ unsafe impl Grouped for CompletionSuggest { } impl ProgramCollect for ThisProgram { - type Enum = ThisProgram; + type Enum = Self; type EntryFallback = EntryFallback; @@ -260,13 +260,15 @@ impl ProgramCollect for ThisProgram { } impl ThisProgram { - /// Create a program through this ProgramCollect. - pub fn new() -> Program { + /// Create a program through this `ProgramCollect`. + #[must_use] + pub fn new() -> Program { todo!() } /// Get the global singleton of the current program. - pub fn this() -> &'static Program { + #[must_use] + pub fn this() -> &'static Program { todo!() } } -- cgit