mirror of
https://github.com/roc-lang/roc.git
synced 2024-11-13 09:49:11 +03:00
clippy
This commit is contained in:
parent
6284a90785
commit
012b4baa2e
@ -3847,47 +3847,8 @@ pub fn build_proc<'a, 'ctx, 'env>(
|
||||
)
|
||||
}
|
||||
|
||||
RawFunctionLayout::ZeroArgumentThunk(result) => {
|
||||
RawFunctionLayout::ZeroArgumentThunk(_) => {
|
||||
// do nothing
|
||||
/*
|
||||
let bytes = roc_mono::alias_analysis::func_name_bytes_help(
|
||||
symbol,
|
||||
std::iter::empty(),
|
||||
top_level.result,
|
||||
);
|
||||
let func_name = FuncName(&bytes);
|
||||
let func_solutions = mod_solutions.func_solutions(func_name).unwrap();
|
||||
|
||||
let mut it = func_solutions.specs();
|
||||
let func_spec = it.next().unwrap();
|
||||
debug_assert!(
|
||||
it.next().is_none(),
|
||||
"we expect only one specialization of this symbol"
|
||||
);
|
||||
|
||||
let evaluator = function_value_by_func_spec(
|
||||
env,
|
||||
*func_spec,
|
||||
symbol,
|
||||
&[],
|
||||
&top_level.result,
|
||||
);
|
||||
|
||||
let ident_string = proc.name.as_str(&env.interns);
|
||||
let fn_name: String = format!("{}_1", ident_string);
|
||||
|
||||
let arena = env.arena;
|
||||
|
||||
build_closure_caller_help(
|
||||
env,
|
||||
&fn_name,
|
||||
evaluator,
|
||||
name,
|
||||
Vec::new_in(arena),
|
||||
result,
|
||||
&result,
|
||||
)
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -64,18 +64,10 @@ where
|
||||
let mut hasher = DefaultHasher::new();
|
||||
|
||||
for layout in argument_layouts {
|
||||
match layout {
|
||||
_ => {
|
||||
layout.hash(&mut hasher);
|
||||
}
|
||||
}
|
||||
layout.hash(&mut hasher);
|
||||
}
|
||||
|
||||
match return_layout {
|
||||
_ => {
|
||||
return_layout.hash(&mut hasher);
|
||||
}
|
||||
}
|
||||
return_layout.hash(&mut hasher);
|
||||
|
||||
hasher.finish()
|
||||
};
|
||||
|
@ -10,9 +10,7 @@ pub const OWNED: bool = false;
|
||||
pub const BORROWED: bool = true;
|
||||
|
||||
fn should_borrow_layout(layout: &Layout) -> bool {
|
||||
match layout {
|
||||
_ => layout.is_refcounted(),
|
||||
}
|
||||
layout.is_refcounted()
|
||||
}
|
||||
|
||||
pub fn infer_borrow<'a>(
|
||||
|
@ -160,12 +160,9 @@ impl<'a, 'i> Env<'a, 'i> {
|
||||
fn try_insert_struct_info(&mut self, symbol: Symbol, layout: &Layout<'a>) {
|
||||
use Layout::*;
|
||||
|
||||
match layout {
|
||||
Struct(fields) => {
|
||||
self.constructor_map.insert(symbol, 0);
|
||||
self.layout_map.insert(symbol, Layout::Struct(fields));
|
||||
}
|
||||
_ => {}
|
||||
if let Struct(fields) = layout {
|
||||
self.constructor_map.insert(symbol, 0);
|
||||
self.layout_map.insert(symbol, Layout::Struct(fields));
|
||||
}
|
||||
}
|
||||
|
||||
@ -359,13 +356,10 @@ pub fn expand_and_cancel_proc<'a>(
|
||||
let mut introduced = Vec::new_in(env.arena);
|
||||
|
||||
for (layout, symbol) in arguments {
|
||||
match layout {
|
||||
Layout::Struct(fields) => {
|
||||
env.insert_struct_info(*symbol, fields);
|
||||
if let Layout::Struct(fields) = layout {
|
||||
env.insert_struct_info(*symbol, fields);
|
||||
|
||||
introduced.push(*symbol);
|
||||
}
|
||||
_ => {}
|
||||
introduced.push(*symbol);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2032,34 +2032,8 @@ fn specialize_external<'a>(
|
||||
|
||||
aliases.insert(*symbol, (name, top_level, layout));
|
||||
}
|
||||
RawFunctionLayout::ZeroArgumentThunk(return_layout) => {
|
||||
panic!("should be unused");
|
||||
/*
|
||||
let assigned = env.unique_symbol();
|
||||
|
||||
let hole = env.arena.alloc(Stmt::Ret(assigned));
|
||||
|
||||
let body = force_thunk(env, name, return_layout, assigned, hole);
|
||||
|
||||
let proc = Proc {
|
||||
name,
|
||||
args: &[],
|
||||
body,
|
||||
closure_data_layout: None,
|
||||
ret_layout: return_layout,
|
||||
is_self_recursive: SelfRecursive::NotSelfRecursive,
|
||||
must_own_arguments: false,
|
||||
host_exposed_layouts: HostExposedLayouts::NotHostExposed,
|
||||
};
|
||||
|
||||
let top_level = ProcLayout::new(env.arena, &[], return_layout);
|
||||
|
||||
procs
|
||||
.specialized
|
||||
.insert((name, top_level), InProgressProc::Done(proc));
|
||||
|
||||
aliases.insert(*symbol, (name, top_level, layout));
|
||||
*/
|
||||
RawFunctionLayout::ZeroArgumentThunk(_) => {
|
||||
unreachable!("so far");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -440,17 +440,14 @@ impl<'a> LambdaSet<'a> {
|
||||
// here we rely on the fact that a union in a closure would be stored in a one-element record.
|
||||
// a closure representation that is itself union must be a of the shape `Closure1 ... | Closure2 ...`
|
||||
match union {
|
||||
UnionLayout::NonRecursive(tags) => {
|
||||
let index = self
|
||||
UnionLayout::NonRecursive(_) => {
|
||||
// get the fields from the set, where they are sorted in alphabetic order
|
||||
// (and not yet sorted by their alignment)
|
||||
let (index, (_, fields)) = self
|
||||
.set
|
||||
.iter()
|
||||
.position(|(s, _)| *s == function_symbol)
|
||||
.unwrap();
|
||||
|
||||
let (_, fields) = self
|
||||
.set
|
||||
.iter()
|
||||
.find(|(s, _)| *s == function_symbol)
|
||||
.enumerate()
|
||||
.find(|(_, (s, _))| *s == function_symbol)
|
||||
.unwrap();
|
||||
|
||||
ClosureRepresentation::Union {
|
||||
@ -473,6 +470,8 @@ impl<'a> LambdaSet<'a> {
|
||||
}
|
||||
}
|
||||
Layout::Struct(_) => {
|
||||
// get the fields from the set, where they are sorted in alphabetic order
|
||||
// (and not yet sorted by their alignment)
|
||||
let (_, fields) = self
|
||||
.set
|
||||
.iter()
|
||||
|
Loading…
Reference in New Issue
Block a user