diff --git a/crates/irust/src/utils.rs b/crates/irust/src/utils.rs index 59a40d9..6260342 100644 --- a/crates/irust/src/utils.rs +++ b/crates/irust/src/utils.rs @@ -296,7 +296,7 @@ pub fn ctrlc_cancel(process: &mut std::process::Child) -> Result<()> { }) => { use std::io::Write; // Ignore write errors (process might have ended) - let _ = process.stdin.as_mut().unwrap().write_all(&[b'\n']); + let _ = process.stdin.as_mut().unwrap().write_all(b"\n"); } _ => (), } diff --git a/crates/irust_repl/examples/re/main.rs b/crates/irust_repl/examples/re/main.rs index 63c4d70..a4a855c 100644 --- a/crates/irust_repl/examples/re/main.rs +++ b/crates/irust_repl/examples/re/main.rs @@ -55,9 +55,13 @@ fn main() -> Result<()> { let mut code = message.code.trim(); // detect `!irust` special comment if code.starts_with("//") && code.contains("!irust") { - code = code.splitn(2, "!irust").nth(1).expect("checked").trim(); + code = code + .split_once("!irust") + .map(|x| x.1) + .expect("checked") + .trim(); } - if code.ends_with(';') || is_a_statement(&code) { + if code.ends_with(';') || is_a_statement(code) { let EvalResult { output, status } = repl.eval_check(code.to_owned())?; if !status.success() { let output = serde_json::to_string(&Action::Eval { @@ -69,7 +73,7 @@ fn main() -> Result<()> { return Ok(()); } // No error, insert the code - repl.insert(&code); + repl.insert(code); let output = serde_json::to_string(&Action::Insert)?; println!("{output}"); } else if code.starts_with(":add") {