mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
Clippy
This commit is contained in:
parent
5624c492da
commit
b05874924f
4 changed files with 17 additions and 20 deletions
|
@ -17,7 +17,7 @@ pub struct Symbol(u64);
|
||||||
// Set it to false if you want to see the raw ModuleId and IdentId ints,
|
// Set it to false if you want to see the raw ModuleId and IdentId ints,
|
||||||
// but please set it back to true before checking in the result!
|
// but please set it back to true before checking in the result!
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
const PRETTY_PRINT_DEBUG_SYMBOLS: bool = false;
|
const PRETTY_PRINT_DEBUG_SYMBOLS: bool = true;
|
||||||
|
|
||||||
/// In Debug builds only, Symbol has a name() method that lets
|
/// In Debug builds only, Symbol has a name() method that lets
|
||||||
/// you look up its name in a global intern table. This table is
|
/// you look up its name in a global intern table. This table is
|
||||||
|
|
|
@ -51,20 +51,12 @@ pub fn deep_copy_type_vars_into_expr<'a>(
|
||||||
|
|
||||||
match expr {
|
match expr {
|
||||||
Num(var, str, val, bound) => Num(sub!(*var), str.clone(), val.clone(), *bound),
|
Num(var, str, val, bound) => Num(sub!(*var), str.clone(), val.clone(), *bound),
|
||||||
Int(v1, v2, str, val, bound) => Int(
|
Int(v1, v2, str, val, bound) => {
|
||||||
sub!(*v1),
|
Int(sub!(*v1), sub!(*v2), str.clone(), val.clone(), *bound)
|
||||||
sub!(*v2),
|
}
|
||||||
str.clone(),
|
Float(v1, v2, str, val, bound) => {
|
||||||
val.clone(),
|
Float(sub!(*v1), sub!(*v2), str.clone(), *val, *bound)
|
||||||
bound.clone(),
|
}
|
||||||
),
|
|
||||||
Float(v1, v2, str, val, bound) => Float(
|
|
||||||
sub!(*v1),
|
|
||||||
sub!(*v2),
|
|
||||||
str.clone(),
|
|
||||||
val.clone(),
|
|
||||||
bound.clone(),
|
|
||||||
),
|
|
||||||
Str(str) => Str(str.clone()),
|
Str(str) => Str(str.clone()),
|
||||||
SingleQuote(char) => SingleQuote(*char),
|
SingleQuote(char) => SingleQuote(*char),
|
||||||
List {
|
List {
|
||||||
|
@ -491,7 +483,7 @@ fn deep_copy_type_vars<'a>(
|
||||||
|
|
||||||
// Everything else is a mechanical descent.
|
// Everything else is a mechanical descent.
|
||||||
Structure(flat_type) => match flat_type {
|
Structure(flat_type) => match flat_type {
|
||||||
EmptyRecord | EmptyTagUnion | Erroneous(_) => Structure(flat_type.clone()),
|
EmptyRecord | EmptyTagUnion | Erroneous(_) => Structure(flat_type),
|
||||||
Apply(symbol, arguments) => {
|
Apply(symbol, arguments) => {
|
||||||
descend_slice!(arguments);
|
descend_slice!(arguments);
|
||||||
|
|
||||||
|
|
|
@ -3193,6 +3193,7 @@ pub fn with_hole<'a>(
|
||||||
}
|
}
|
||||||
LetNonRec(def, cont, _) => {
|
LetNonRec(def, cont, _) => {
|
||||||
if let roc_can::pattern::Pattern::Identifier(symbol) = def.loc_pattern.value {
|
if let roc_can::pattern::Pattern::Identifier(symbol) = def.loc_pattern.value {
|
||||||
|
dbg!(symbol);
|
||||||
if let Closure(closure_data) = def.loc_expr.value {
|
if let Closure(closure_data) = def.loc_expr.value {
|
||||||
register_noncapturing_closure(env, procs, symbol, closure_data);
|
register_noncapturing_closure(env, procs, symbol, closure_data);
|
||||||
|
|
||||||
|
@ -3338,6 +3339,7 @@ pub fn with_hole<'a>(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Var(symbol) => {
|
Var(symbol) => {
|
||||||
|
dbg!(symbol);
|
||||||
specialize_naked_symbol(env, variable, procs, layout_cache, assigned, hole, symbol)
|
specialize_naked_symbol(env, variable, procs, layout_cache, assigned, hole, symbol)
|
||||||
}
|
}
|
||||||
Tag {
|
Tag {
|
||||||
|
@ -5438,6 +5440,7 @@ pub fn from_can<'a>(
|
||||||
}
|
}
|
||||||
LetNonRec(def, cont, outer_annotation) => {
|
LetNonRec(def, cont, outer_annotation) => {
|
||||||
if let roc_can::pattern::Pattern::Identifier(symbol) = &def.loc_pattern.value {
|
if let roc_can::pattern::Pattern::Identifier(symbol) = &def.loc_pattern.value {
|
||||||
|
dbg!(symbol);
|
||||||
match def.loc_expr.value {
|
match def.loc_expr.value {
|
||||||
roc_can::expr::Expr::Closure(closure_data) => {
|
roc_can::expr::Expr::Closure(closure_data) => {
|
||||||
register_capturing_closure(env, procs, layout_cache, *symbol, closure_data);
|
register_capturing_closure(env, procs, layout_cache, *symbol, closure_data);
|
||||||
|
@ -5572,8 +5575,7 @@ pub fn from_can<'a>(
|
||||||
let needs_def_specializations = procs
|
let needs_def_specializations = procs
|
||||||
.needed_symbol_specializations
|
.needed_symbol_specializations
|
||||||
.keys()
|
.keys()
|
||||||
.find(|(s, _)| s == symbol)
|
.any(|(s, _)| s == symbol);
|
||||||
.is_some();
|
|
||||||
|
|
||||||
if !needs_def_specializations {
|
if !needs_def_specializations {
|
||||||
return with_hole(
|
return with_hole(
|
||||||
|
@ -6709,8 +6711,7 @@ fn possible_reuse_symbol_or_spec<'a>(
|
||||||
let needs_fresh_symbol = procs
|
let needs_fresh_symbol = procs
|
||||||
.needed_symbol_specializations
|
.needed_symbol_specializations
|
||||||
.keys()
|
.keys()
|
||||||
.find(|(s, _)| *s == symbol)
|
.any(|(s, _)| *s == symbol);
|
||||||
.is_some();
|
|
||||||
|
|
||||||
let (_, specialized_symbol) = procs
|
let (_, specialized_symbol) = procs
|
||||||
.needed_symbol_specializations
|
.needed_symbol_specializations
|
||||||
|
|
|
@ -457,6 +457,10 @@ impl Pools {
|
||||||
self.0.len()
|
self.0.len()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_empty(&self) -> bool {
|
||||||
|
self.len() == 0
|
||||||
|
}
|
||||||
|
|
||||||
pub fn get_mut(&mut self, rank: Rank) -> &mut Vec<Variable> {
|
pub fn get_mut(&mut self, rank: Rank) -> &mut Vec<Variable> {
|
||||||
match self.0.get_mut(rank.into_usize()) {
|
match self.0.get_mut(rank.into_usize()) {
|
||||||
Some(reference) => reference,
|
Some(reference) => reference,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue