aboutsummaryrefslogtreecommitdiff
path: root/mingling/src/gen_program.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-08-10 16:21:51 +0800
committer魏曹先生 <1992414357@qq.com>2026-08-10 16:21:51 +0800
commit1c065ed5ec1c1036d185dea91b2f0394d9ddd111 (patch)
tree299a939a6d5ccc14785a61bb3dc3ee306656825f /mingling/src/gen_program.rs
parent2d0aae4b2d595ced100f7a2ec8d13b872a5eb65e (diff)
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.
Diffstat (limited to 'mingling/src/gen_program.rs')
-rw-r--r--mingling/src/gen_program.rs10
1 files changed, 6 insertions, 4 deletions
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<ThisProgram> 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<ThisProgram> {
+ /// Create a program through this `ProgramCollect`.
+ #[must_use]
+ pub fn new() -> Program<Self> {
todo!()
}
/// Get the global singleton of the current program.
- pub fn this() -> &'static Program<ThisProgram> {
+ #[must_use]
+ pub fn this() -> &'static Program<Self> {
todo!()
}
}