This commit is contained in:
Folkert 2021-05-07 11:00:15 +02:00
parent 9a5c20b7c3
commit fecb83b9c2
15 changed files with 45 additions and 41 deletions

View file

@ -211,7 +211,7 @@ pub fn build_file<'a>(
Ok(BuiltFile { Ok(BuiltFile {
binary_path, binary_path,
total_time,
outcome, outcome,
total_time,
}) })
} }

View file

@ -48,8 +48,8 @@ pub unsafe fn jit_to_ast<'a>(
arena, arena,
subs, subs,
ptr_bytes, ptr_bytes,
home,
interns, interns,
home,
}; };
jit_to_ast_help(&env, lib, main_fn_name, layout, content) jit_to_ast_help(&env, lib, main_fn_name, layout, content)

View file

@ -283,8 +283,8 @@ pub fn gen_from_mono_module(
let emit_o_file = emit_o_file_start.elapsed().unwrap(); let emit_o_file = emit_o_file_start.elapsed().unwrap();
CodeGenTiming { CodeGenTiming {
emit_o_file,
code_gen, code_gen,
emit_o_file,
} }
} }

View file

@ -58,7 +58,7 @@ fn new_op_call_expr<'a>(
} }
}; };
Located { value, region } Located { region, value }
} }
fn desugar_def_helps<'a>( fn desugar_def_helps<'a>(
@ -283,11 +283,10 @@ pub fn desugar_expr<'a>(arena: &'a Bump, loc_expr: &'a Located<Expr<'a>>) -> &'a
let mut alternatives = Vec::with_capacity_in(branch.patterns.len(), arena); let mut alternatives = Vec::with_capacity_in(branch.patterns.len(), arena);
alternatives.extend(branch.patterns.iter().copied()); alternatives.extend(branch.patterns.iter().copied());
let desugared_guard = if let Some(guard) = &branch.guard { let desugared_guard = branch
Some(*desugar_expr(arena, guard)) .guard
} else { .as_ref()
None .map(|guard| *desugar_expr(arena, guard));
};
let alternatives = alternatives.into_bump_slice(); let alternatives = alternatives.into_bump_slice();

View file

@ -87,7 +87,7 @@ mod test_can {
IntErrorKind::Overflow, IntErrorKind::Overflow,
Base::Decimal, Base::Decimal,
Region::zero(), Region::zero(),
string.into(), string.into_boxed_str(),
)), )),
); );
} }

View file

@ -1947,11 +1947,11 @@ fn update<'a>(
let typechecked = TypeCheckedModule { let typechecked = TypeCheckedModule {
module_id, module_id,
decls,
solved_subs,
ident_ids,
module_timing,
layout_cache, layout_cache,
module_timing,
solved_subs,
decls,
ident_ids,
}; };
state state
@ -2000,10 +2000,10 @@ fn update<'a>(
.extend(procs.module_thunks.iter().copied()); .extend(procs.module_thunks.iter().copied());
let found_specializations_module = FoundSpecializationsModule { let found_specializations_module = FoundSpecializationsModule {
layout_cache,
module_id, module_id,
procs,
ident_ids, ident_ids,
layout_cache,
procs,
subs, subs,
module_timing, module_timing,
}; };
@ -3715,13 +3715,13 @@ fn parse<'a>(arena: &'a Bump, header: ModuleHeader<'a>) -> Result<Msg<'a>, Loadi
module_id, module_id,
module_name, module_name,
module_path, module_path,
src,
module_timing,
deps_by_name, deps_by_name,
imported_modules,
exposed_ident_ids, exposed_ident_ids,
exposed_imports, exposed_imports,
src,
parsed_defs, parsed_defs,
imported_modules,
module_timing,
}; };
Ok(Msg::Parsed(parsed)) Ok(Msg::Parsed(parsed))

View file

@ -1,3 +1,5 @@
#![allow(clippy::manual_map)]
use self::InProgressProc::*; use self::InProgressProc::*;
use crate::exhaustive::{Ctor, Guard, RenderAs, TagId}; use crate::exhaustive::{Ctor, Guard, RenderAs, TagId};
use crate::layout::{ use crate::layout::{

View file

@ -231,10 +231,8 @@ fn insert_jumps<'a>(
None None
} }
} }
Refcounting(modify, cont) => match insert_jumps(arena, cont, goal_id, needle) { Refcounting(modify, cont) => insert_jumps(arena, cont, goal_id, needle)
Some(cont) => Some(arena.alloc(Refcounting(*modify, cont))), .map(|cont| &*arena.alloc(Refcounting(*modify, cont))),
None => None,
},
Rethrow => None, Rethrow => None,
Ret(_) => None, Ret(_) => None,

View file

@ -1098,10 +1098,10 @@ macro_rules! loc {
let end_col = state.column; let end_col = state.column;
let end_line = state.line; let end_line = state.line;
let region = Region { let region = Region {
start_col,
start_line, start_line,
end_col,
end_line, end_line,
start_col,
end_col,
}; };
Ok((progress, Located { region, value }, state)) Ok((progress, Located { region, value }, state))

View file

@ -92,7 +92,7 @@ fn term<'a>(min_indent: u16) -> impl Parser<'a, Located<TypeAnnotation<'a>>, Typ
let value = let value =
TypeAnnotation::As(arena.alloc(loc_ann), spaces, arena.alloc(loc_as)); TypeAnnotation::As(arena.alloc(loc_ann), spaces, arena.alloc(loc_as));
Located { value, region } Located { region, value }
} }
None => loc_ann, None => loc_ann,

View file

@ -24,8 +24,8 @@ impl Region {
pub const fn new(start_line: u32, end_line: u32, start_col: u16, end_col: u16) -> Self { pub const fn new(start_line: u32, end_line: u32, start_col: u16, end_col: u16) -> Self {
Self { Self {
start_line, start_line,
start_col,
end_line, end_line,
start_col,
end_col, end_col,
} }
} }
@ -106,10 +106,10 @@ impl Region {
end_col: u16, end_col: u16,
) -> Self { ) -> Self {
Region { Region {
start_col,
start_line, start_line,
end_col,
end_line, end_line,
start_col,
end_col,
} }
} }
@ -177,20 +177,20 @@ impl<T> Located<T> {
) -> Located<T> { ) -> Located<T> {
let region = Region { let region = Region {
start_line, start_line,
start_col,
end_line, end_line,
start_col,
end_col, end_col,
}; };
Located { value, region } Located { region, value }
} }
pub fn at(region: Region, value: T) -> Located<T> { pub fn at(region: Region, value: T) -> Located<T> {
Located { value, region } Located { region, value }
} }
pub fn at_zero(value: T) -> Located<T> { pub fn at_zero(value: T) -> Located<T> {
let region = Region::zero(); let region = Region::zero();
Located { value, region } Located { region, value }
} }
} }

View file

@ -149,8 +149,8 @@ pub fn can_problem<'b>(
let (doc, title) = crate::error::r#type::cyclic_alias(alloc, symbol, region, others); let (doc, title) = crate::error::r#type::cyclic_alias(alloc, symbol, region, others);
return Report { return Report {
filename,
title, title,
filename,
doc, doc,
}; };
} }

View file

@ -40,8 +40,8 @@ pub fn type_problem<'b>(
.append(alloc.reflow(".")); .append(alloc.reflow("."));
Report { Report {
filename,
title, title,
filename,
doc, doc,
} }
} }
@ -85,8 +85,8 @@ pub fn type_problem<'b>(
}; };
Report { Report {
filename,
title, title,
filename,
doc, doc,
} }
} }
@ -94,8 +94,8 @@ pub fn type_problem<'b>(
let (doc, title) = cyclic_alias(alloc, symbol, region, others); let (doc, title) = cyclic_alias(alloc, symbol, region, others);
Report { Report {
filename,
title, title,
filename,
doc, doc,
} }
} }

View file

@ -226,10 +226,10 @@ impl ShallowClone for ValueDef {
fn shallow_clone(&self) -> Self { fn shallow_clone(&self) -> Self {
Self { Self {
pattern: self.pattern, pattern: self.pattern,
expr_type: match &self.expr_type { expr_type: self
Some((id, rigids)) => Some((*id, rigids.shallow_clone())), .expr_type
None => None, .as_ref()
}, .map(|(id, rigids)| (*id, rigids.shallow_clone())),
expr_var: self.expr_var, expr_var: self.expr_var,
} }
} }

View file

@ -263,11 +263,16 @@ impl PoolStr {
} }
} }
#[allow(clippy::len_without_is_empty)]
pub fn len(&self, pool: &Pool) -> usize { pub fn len(&self, pool: &Pool) -> usize {
let contents = self.as_str(pool); let contents = self.as_str(pool);
contents.len() contents.len()
} }
pub fn is_empty(&self, pool: &Pool) -> bool {
self.len(pool) == 0
}
} }
impl ShallowClone for PoolStr { impl ShallowClone for PoolStr {