Skip to content

Commit

Permalink
apply suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
vuvoth committed Feb 14, 2024
1 parent 80cd829 commit 60a5f2a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
16 changes: 8 additions & 8 deletions src/cli/repl/meta_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,14 +531,14 @@ where
}
let open = repl.store.intern_lurk_symbol("open");
let open_expr = repl.store.list(vec![open, repl.store.num(hash)]);
if let Some((args_vec, _)) = repl.store.fetch_list(&args) {
let mut expr_vec = Vec::with_capacity(args_vec.len() + 1);
expr_vec.push(open_expr);
expr_vec.extend(args_vec);
repl.handle_non_meta(repl.store.list(expr_vec))
} else {
Err(anyhow!("Data must have been interned"))
}
let Some((args_vec, _)) = repl.store.fetch_list(&args) else {
bail!("Data must have been interned");
};

let mut expr_vec = Vec::with_capacity(args_vec.len() + 1);
expr_vec.push(open_expr);
expr_vec.extend(args_vec);
repl.handle_non_meta(repl.store.list(expr_vec))
}

const CALL: MetaCmd<F, C> = MetaCmd {
Expand Down
22 changes: 11 additions & 11 deletions src/cli/repl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -586,19 +586,19 @@ where

let mut input = parser::Span::new(&input);
loop {
if let Some(file_dir) = file_path.parent() {
match self.handle_form(input, file_dir, demo) {
Ok(new_input) => input = new_input,
Err(e) => {
if let Some(parser::Error::NoInput) = e.downcast_ref::<parser::Error>() {
// It's ok, it just means we've hit the EOF
return Ok(());
}
return Err(e);
let Some(file_dir) = file_path.parent() else {
bail!("Can't load parent of {}", file_path);
};

match self.handle_form(input, file_dir, demo) {
Ok(new_input) => input = new_input,
Err(e) => {
if let Some(parser::Error::NoInput) = e.downcast_ref::<parser::Error>() {
// It's ok, it just means we've hit the EOF
return Ok(());
}
return Err(e);
}
} else {
return Err(anyhow!("Can't load parent of {}", file_path));
}
}
}
Expand Down

0 comments on commit 60a5f2a

Please sign in to comment.