mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
clippy
This commit is contained in:
parent
6284a90785
commit
012b4baa2e
6 changed files with 20 additions and 102 deletions
|
@ -3847,47 +3847,8 @@ pub fn build_proc<'a, 'ctx, 'env>(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
RawFunctionLayout::ZeroArgumentThunk(result) => {
|
RawFunctionLayout::ZeroArgumentThunk(_) => {
|
||||||
// do nothing
|
// 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();
|
let mut hasher = DefaultHasher::new();
|
||||||
|
|
||||||
for layout in argument_layouts {
|
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()
|
hasher.finish()
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,9 +10,7 @@ pub const OWNED: bool = false;
|
||||||
pub const BORROWED: bool = true;
|
pub const BORROWED: bool = true;
|
||||||
|
|
||||||
fn should_borrow_layout(layout: &Layout) -> bool {
|
fn should_borrow_layout(layout: &Layout) -> bool {
|
||||||
match layout {
|
layout.is_refcounted()
|
||||||
_ => layout.is_refcounted(),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn infer_borrow<'a>(
|
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>) {
|
fn try_insert_struct_info(&mut self, symbol: Symbol, layout: &Layout<'a>) {
|
||||||
use Layout::*;
|
use Layout::*;
|
||||||
|
|
||||||
match layout {
|
if let Struct(fields) = layout {
|
||||||
Struct(fields) => {
|
self.constructor_map.insert(symbol, 0);
|
||||||
self.constructor_map.insert(symbol, 0);
|
self.layout_map.insert(symbol, Layout::Struct(fields));
|
||||||
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);
|
let mut introduced = Vec::new_in(env.arena);
|
||||||
|
|
||||||
for (layout, symbol) in arguments {
|
for (layout, symbol) in arguments {
|
||||||
match layout {
|
if let Layout::Struct(fields) = layout {
|
||||||
Layout::Struct(fields) => {
|
env.insert_struct_info(*symbol, fields);
|
||||||
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));
|
aliases.insert(*symbol, (name, top_level, layout));
|
||||||
}
|
}
|
||||||
RawFunctionLayout::ZeroArgumentThunk(return_layout) => {
|
RawFunctionLayout::ZeroArgumentThunk(_) => {
|
||||||
panic!("should be unused");
|
unreachable!("so far");
|
||||||
/*
|
|
||||||
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));
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.
|
// 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 ...`
|
// a closure representation that is itself union must be a of the shape `Closure1 ... | Closure2 ...`
|
||||||
match union {
|
match union {
|
||||||
UnionLayout::NonRecursive(tags) => {
|
UnionLayout::NonRecursive(_) => {
|
||||||
let index = self
|
// 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
|
.set
|
||||||
.iter()
|
.iter()
|
||||||
.position(|(s, _)| *s == function_symbol)
|
.enumerate()
|
||||||
.unwrap();
|
.find(|(_, (s, _))| *s == function_symbol)
|
||||||
|
|
||||||
let (_, fields) = self
|
|
||||||
.set
|
|
||||||
.iter()
|
|
||||||
.find(|(s, _)| *s == function_symbol)
|
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
ClosureRepresentation::Union {
|
ClosureRepresentation::Union {
|
||||||
|
@ -473,6 +470,8 @@ impl<'a> LambdaSet<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Layout::Struct(_) => {
|
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
|
let (_, fields) = self
|
||||||
.set
|
.set
|
||||||
.iter()
|
.iter()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue