mirror of
https://github.com/roc-lang/roc.git
synced 2024-11-11 05:34:11 +03:00
repl: formatting and Clippy
This commit is contained in:
parent
3c07066ace
commit
b317e05187
@ -27,9 +27,6 @@ use roc_repl_eval::ReplApp;
|
||||
use roc_target::TargetInfo;
|
||||
use roc_types::pretty_print::{content_to_string, name_all_type_vars};
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
const BLUE: &str = "\u{001b}[36m";
|
||||
const PINK: &str = "\u{001b}[35m";
|
||||
const END_COL: &str = "\u{001b}[0m";
|
||||
@ -213,7 +210,7 @@ impl ReplApp for CliReplApp {
|
||||
}
|
||||
|
||||
/// Run user code that returns a struct or union, whose size is provided as an argument
|
||||
fn call_function_dynamic_size<'a, T: Sized, F: Fn(usize) -> T>(
|
||||
fn call_function_dynamic_size<T: Sized, F: Fn(usize) -> T>(
|
||||
&self,
|
||||
main_fn_name: &str,
|
||||
bytes: usize,
|
||||
@ -380,19 +377,17 @@ fn gen_and_eval_llvm<'a>(
|
||||
|
||||
let app = CliReplApp { lib };
|
||||
|
||||
let res_answer = unsafe {
|
||||
jit_to_ast(
|
||||
&arena,
|
||||
&app,
|
||||
main_fn_name,
|
||||
main_fn_layout,
|
||||
content,
|
||||
&env.interns,
|
||||
home,
|
||||
&subs,
|
||||
target_info,
|
||||
)
|
||||
};
|
||||
let res_answer = jit_to_ast(
|
||||
&arena,
|
||||
&app,
|
||||
main_fn_name,
|
||||
main_fn_layout,
|
||||
content,
|
||||
&env.interns,
|
||||
home,
|
||||
&subs,
|
||||
target_info,
|
||||
);
|
||||
|
||||
let formatted = format_answer(&arena, res_answer, expr_type_str);
|
||||
Ok(formatted)
|
||||
|
@ -40,7 +40,7 @@ pub enum ToAstProblem {
|
||||
/// we get to a struct or tag, we know what the labels are and can turn them
|
||||
/// back into the appropriate user-facing literals.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub unsafe fn jit_to_ast<'a, A: ReplApp>(
|
||||
pub fn jit_to_ast<'a, A: ReplApp>(
|
||||
arena: &'a Bump,
|
||||
app: &'a A,
|
||||
main_fn_name: &str,
|
||||
@ -385,7 +385,7 @@ fn jit_to_ast_help<'a, A: ReplApp>(
|
||||
env.app.call_function_dynamic_size(
|
||||
main_fn_name,
|
||||
result_stack_size as usize,
|
||||
|bytes_addr: usize| struct_addr_to_ast(bytes_addr),
|
||||
struct_addr_to_ast,
|
||||
)
|
||||
}
|
||||
Layout::Union(UnionLayout::NonRecursive(_)) => {
|
||||
|
@ -31,7 +31,7 @@ pub trait ReplApp {
|
||||
transform: F,
|
||||
) -> Expr<'a>;
|
||||
|
||||
fn call_function_dynamic_size<'a, T: Sized, F: Fn(usize) -> T>(
|
||||
fn call_function_dynamic_size<T: Sized, F: Fn(usize) -> T>(
|
||||
&self,
|
||||
main_fn_name: &str,
|
||||
ret_bytes: usize,
|
||||
|
Loading…
Reference in New Issue
Block a user