From 1ab19e8765ea2ed62c8a41113d84867facaabf08 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Mon, 1 Jun 2026 12:55:23 +0800 Subject: Change `ProgramSetup::setup` to consume `self` instead of borrow --- mingling/src/setups/repl_basic.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'mingling/src/setups/repl_basic.rs') diff --git a/mingling/src/setups/repl_basic.rs b/mingling/src/setups/repl_basic.rs index fbb806e..8b9b83f 100644 --- a/mingling/src/setups/repl_basic.rs +++ b/mingling/src/setups/repl_basic.rs @@ -8,7 +8,7 @@ impl ProgramSetup for BasicREPLReadlineSetup where C: ProgramCollect, { - fn setup(&mut self, program: &mut Program) { + fn setup(self, program: &mut Program) { program.with_hook(ProgramHook::empty().on_repl_readline(|| readline().ok())); } } @@ -39,7 +39,7 @@ impl ProgramSetup for BasicREPLPromptSetup where C: ProgramCollect, { - fn setup(&mut self, program: &mut Program) { + fn setup(self, program: &mut Program) { match self { BasicREPLPromptSetup::Prompt(prompt) => { static PROMPT: std::sync::OnceLock = std::sync::OnceLock::new(); @@ -52,7 +52,7 @@ where } BasicREPLPromptSetup::Func(f) => { static FUNC: std::sync::OnceLock String> = std::sync::OnceLock::new(); - let _ = FUNC.set(*f); + let _ = FUNC.set(f); fn print_func_prompt() { print!("{}", FUNC.get().unwrap()()); let _ = std::io::stdout().flush(); @@ -69,7 +69,7 @@ impl ProgramSetup for BasicREPLOutputSetup where C: ProgramCollect, { - fn setup(&mut self, program: &mut Program) { + fn setup(self, program: &mut Program) { program.with_hook(ProgramHook::empty().on_repl_receive_result(|r| { if !r.is_empty() { println!("{}", r.trim()) -- cgit