Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
sigmaSd committed Jul 25, 2024
1 parent 5914663 commit 1345c7e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion crates/irust/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
_ => (),
}
Expand Down
10 changes: 7 additions & 3 deletions crates/irust_repl/examples/re/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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") {
Expand Down

0 comments on commit 1345c7e

Please sign in to comment.