mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
Make clippy happy
This commit is contained in:
parent
26978b58b4
commit
eb7e39bf7b
5 changed files with 68 additions and 74 deletions
|
@ -48,7 +48,7 @@ pub fn build_file(
|
||||||
|
|
||||||
buf.push_str(" ");
|
buf.push_str(" ");
|
||||||
buf.push_str(module_name);
|
buf.push_str(module_name);
|
||||||
buf.push_str("\n");
|
buf.push('\n');
|
||||||
|
|
||||||
report_timing(buf, "Read .roc file from disk", module_timing.read_roc_file);
|
report_timing(buf, "Read .roc file from disk", module_timing.read_roc_file);
|
||||||
report_timing(buf, "Parse header", module_timing.parse_header);
|
report_timing(buf, "Parse header", module_timing.parse_header);
|
||||||
|
|
|
@ -89,13 +89,7 @@ impl Default for Pools {
|
||||||
|
|
||||||
impl Pools {
|
impl Pools {
|
||||||
pub fn new(num_pools: usize) -> Self {
|
pub fn new(num_pools: usize) -> Self {
|
||||||
let mut pools = Vec::with_capacity(num_pools);
|
Pools(vec![Vec::new(); num_pools])
|
||||||
|
|
||||||
for _ in 0..num_pools {
|
|
||||||
pools.push(Vec::new());
|
|
||||||
}
|
|
||||||
|
|
||||||
Pools(pools)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn len(&self) -> usize {
|
pub fn len(&self) -> usize {
|
||||||
|
|
|
@ -676,7 +676,7 @@ fn write_boolean(env: &Env, boolean: Bool, subs: &Subs, buf: &mut String, parens
|
||||||
|
|
||||||
let combined = buffers.join(" | ");
|
let combined = buffers.join(" | ");
|
||||||
|
|
||||||
buf.push_str("(");
|
buf.push('(');
|
||||||
write_content(
|
write_content(
|
||||||
env,
|
env,
|
||||||
subs.get_without_compacting(cvar).content,
|
subs.get_without_compacting(cvar).content,
|
||||||
|
@ -686,7 +686,7 @@ fn write_boolean(env: &Env, boolean: Bool, subs: &Subs, buf: &mut String, parens
|
||||||
);
|
);
|
||||||
buf.push_str(" | ");
|
buf.push_str(" | ");
|
||||||
buf.push_str(&combined);
|
buf.push_str(&combined);
|
||||||
buf.push_str(")");
|
buf.push(')');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -716,7 +716,7 @@ fn write_apply(
|
||||||
|
|
||||||
let mut default_case = |subs, content| {
|
let mut default_case = |subs, content| {
|
||||||
if write_parens {
|
if write_parens {
|
||||||
buf.push_str("(");
|
buf.push('(');
|
||||||
}
|
}
|
||||||
|
|
||||||
write_content(env, content, subs, &mut arg_param, Parens::InTypeParam);
|
write_content(env, content, subs, &mut arg_param, Parens::InTypeParam);
|
||||||
|
@ -724,7 +724,7 @@ fn write_apply(
|
||||||
buf.push_str(&arg_param);
|
buf.push_str(&arg_param);
|
||||||
|
|
||||||
if write_parens {
|
if write_parens {
|
||||||
buf.push_str(")");
|
buf.push(')');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -762,13 +762,13 @@ fn write_apply(
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
if write_parens {
|
if write_parens {
|
||||||
buf.push_str("(");
|
buf.push('(');
|
||||||
}
|
}
|
||||||
|
|
||||||
write_symbol(env, symbol, buf);
|
write_symbol(env, symbol, buf);
|
||||||
|
|
||||||
for arg in args {
|
for arg in args {
|
||||||
buf.push_str(" ");
|
buf.push(' ');
|
||||||
write_content(
|
write_content(
|
||||||
env,
|
env,
|
||||||
subs.get_without_compacting(arg).content,
|
subs.get_without_compacting(arg).content,
|
||||||
|
@ -779,7 +779,7 @@ fn write_apply(
|
||||||
}
|
}
|
||||||
|
|
||||||
if write_parens {
|
if write_parens {
|
||||||
buf.push_str(")");
|
buf.push(')');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -797,7 +797,7 @@ fn write_fn(
|
||||||
let use_parens = parens != Parens::Unnecessary;
|
let use_parens = parens != Parens::Unnecessary;
|
||||||
|
|
||||||
if use_parens {
|
if use_parens {
|
||||||
buf.push_str("(");
|
buf.push('(');
|
||||||
}
|
}
|
||||||
|
|
||||||
for arg in args {
|
for arg in args {
|
||||||
|
@ -826,7 +826,7 @@ fn write_fn(
|
||||||
);
|
);
|
||||||
|
|
||||||
if use_parens {
|
if use_parens {
|
||||||
buf.push_str(")");
|
buf.push(')');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1063,7 +1063,7 @@ fn write_error_type_help(
|
||||||
|
|
||||||
match error_type {
|
match error_type {
|
||||||
Infinite => buf.push_str("∞"),
|
Infinite => buf.push_str("∞"),
|
||||||
Error => buf.push_str("?"),
|
Error => buf.push('?'),
|
||||||
FlexVar(name) => buf.push_str(name.as_str()),
|
FlexVar(name) => buf.push_str(name.as_str()),
|
||||||
RigidVar(name) => buf.push_str(name.as_str()),
|
RigidVar(name) => buf.push_str(name.as_str()),
|
||||||
Type(symbol, arguments) => {
|
Type(symbol, arguments) => {
|
||||||
|
@ -1181,7 +1181,7 @@ fn write_debug_error_type_help(error_type: ErrorType, buf: &mut String, parens:
|
||||||
|
|
||||||
match error_type {
|
match error_type {
|
||||||
Infinite => buf.push_str("∞"),
|
Infinite => buf.push_str("∞"),
|
||||||
Error => buf.push_str("?"),
|
Error => buf.push('?'),
|
||||||
FlexVar(name) => buf.push_str(name.as_str()),
|
FlexVar(name) => buf.push_str(name.as_str()),
|
||||||
RigidVar(name) => buf.push_str(name.as_str()),
|
RigidVar(name) => buf.push_str(name.as_str()),
|
||||||
Type(symbol, arguments) => {
|
Type(symbol, arguments) => {
|
||||||
|
@ -1316,7 +1316,7 @@ fn write_debug_error_type_help(error_type: ErrorType, buf: &mut String, parens:
|
||||||
while let Some((tag, args)) = it.next() {
|
while let Some((tag, args)) = it.next() {
|
||||||
buf.push_str(&format!("{:?}", tag));
|
buf.push_str(&format!("{:?}", tag));
|
||||||
for arg in args {
|
for arg in args {
|
||||||
buf.push_str(" ");
|
buf.push(' ');
|
||||||
write_debug_error_type_help(arg, buf, Parens::InTypeParam);
|
write_debug_error_type_help(arg, buf, Parens::InTypeParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1335,7 +1335,7 @@ fn write_debug_error_type_help(error_type: ErrorType, buf: &mut String, parens:
|
||||||
while let Some((tag, args)) = it.next() {
|
while let Some((tag, args)) = it.next() {
|
||||||
buf.push_str(&format!("{:?}", tag));
|
buf.push_str(&format!("{:?}", tag));
|
||||||
for arg in args {
|
for arg in args {
|
||||||
buf.push_str(" ");
|
buf.push(' ');
|
||||||
write_debug_error_type_help(arg, buf, Parens::Unnecessary);
|
write_debug_error_type_help(arg, buf, Parens::Unnecessary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,42 +13,42 @@ pub fn handle_text_input(
|
||||||
}
|
}
|
||||||
|
|
||||||
match virtual_keycode {
|
match virtual_keycode {
|
||||||
Key1 | Numpad1 => text_state.push_str("1"),
|
Key1 | Numpad1 => text_state.push('1'),
|
||||||
Key2 | Numpad2 => text_state.push_str("2"),
|
Key2 | Numpad2 => text_state.push('2'),
|
||||||
Key3 | Numpad3 => text_state.push_str("3"),
|
Key3 | Numpad3 => text_state.push('3'),
|
||||||
Key4 | Numpad4 => text_state.push_str("4"),
|
Key4 | Numpad4 => text_state.push('4'),
|
||||||
Key5 | Numpad5 => text_state.push_str("5"),
|
Key5 | Numpad5 => text_state.push('5'),
|
||||||
Key6 | Numpad6 => text_state.push_str("6"),
|
Key6 | Numpad6 => text_state.push('6'),
|
||||||
Key7 | Numpad7 => text_state.push_str("7"),
|
Key7 | Numpad7 => text_state.push('7'),
|
||||||
Key8 | Numpad8 => text_state.push_str("8"),
|
Key8 | Numpad8 => text_state.push('8'),
|
||||||
Key9 | Numpad9 => text_state.push_str("9"),
|
Key9 | Numpad9 => text_state.push('9'),
|
||||||
Key0 | Numpad0 => text_state.push_str("0"),
|
Key0 | Numpad0 => text_state.push('0'),
|
||||||
A => text_state.push_str("a"),
|
A => text_state.push('a'),
|
||||||
B => text_state.push_str("b"),
|
B => text_state.push('b'),
|
||||||
C => text_state.push_str("c"),
|
C => text_state.push('c'),
|
||||||
D => text_state.push_str("d"),
|
D => text_state.push('d'),
|
||||||
E => text_state.push_str("e"),
|
E => text_state.push('e'),
|
||||||
F => text_state.push_str("f"),
|
F => text_state.push('f'),
|
||||||
G => text_state.push_str("g"),
|
G => text_state.push('g'),
|
||||||
H => text_state.push_str("h"),
|
H => text_state.push('h'),
|
||||||
I => text_state.push_str("i"),
|
I => text_state.push('i'),
|
||||||
J => text_state.push_str("j"),
|
J => text_state.push('j'),
|
||||||
K => text_state.push_str("k"),
|
K => text_state.push('k'),
|
||||||
L => text_state.push_str("l"),
|
L => text_state.push('l'),
|
||||||
M => text_state.push_str("m"),
|
M => text_state.push('m'),
|
||||||
N => text_state.push_str("n"),
|
N => text_state.push('n'),
|
||||||
O => text_state.push_str("o"),
|
O => text_state.push('o'),
|
||||||
P => text_state.push_str("p"),
|
P => text_state.push('p'),
|
||||||
Q => text_state.push_str("q"),
|
Q => text_state.push('q'),
|
||||||
R => text_state.push_str("r"),
|
R => text_state.push('r'),
|
||||||
S => text_state.push_str("s"),
|
S => text_state.push('s'),
|
||||||
T => text_state.push_str("t"),
|
T => text_state.push('t'),
|
||||||
U => text_state.push_str("u"),
|
U => text_state.push('u'),
|
||||||
V => text_state.push_str("v"),
|
V => text_state.push('v'),
|
||||||
W => text_state.push_str("w"),
|
W => text_state.push('w'),
|
||||||
X => text_state.push_str("x"),
|
X => text_state.push('x'),
|
||||||
Y => text_state.push_str("y"),
|
Y => text_state.push('y'),
|
||||||
Z => text_state.push_str("z"),
|
Z => text_state.push('z'),
|
||||||
Escape | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | F13 | F14 | F15
|
Escape | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | F13 | F14 | F15
|
||||||
| F16 | F17 | F18 | F19 | F20 | F21 | F22 | F23 | F24 | Snapshot | Scroll | Pause
|
| F16 | F17 | F18 | F19 | F20 | F21 | F22 | F23 | F24 | Snapshot | Scroll | Pause
|
||||||
| Insert | Home | Delete | End | PageDown | PageUp | Left | Up | Right | Down | Compose
|
| Insert | Home | Delete | End | PageDown | PageUp | Left | Up | Right | Down | Compose
|
||||||
|
@ -65,55 +65,55 @@ pub fn handle_text_input(
|
||||||
text_state.pop();
|
text_state.pop();
|
||||||
}
|
}
|
||||||
Return | NumpadEnter => {
|
Return | NumpadEnter => {
|
||||||
text_state.push_str("\n");
|
text_state.push('\n');
|
||||||
}
|
}
|
||||||
Space => {
|
Space => {
|
||||||
text_state.push_str(" ");
|
text_state.push(' ');
|
||||||
}
|
}
|
||||||
Comma | NumpadComma => {
|
Comma | NumpadComma => {
|
||||||
text_state.push_str(",");
|
text_state.push(',');
|
||||||
}
|
}
|
||||||
Add => {
|
Add => {
|
||||||
text_state.push_str("+");
|
text_state.push('+');
|
||||||
}
|
}
|
||||||
Apostrophe => {
|
Apostrophe => {
|
||||||
text_state.push_str("'");
|
text_state.push('\'');
|
||||||
}
|
}
|
||||||
At => {
|
At => {
|
||||||
text_state.push_str("@");
|
text_state.push('@');
|
||||||
}
|
}
|
||||||
Backslash => {
|
Backslash => {
|
||||||
text_state.push_str("\\");
|
text_state.push('\\');
|
||||||
}
|
}
|
||||||
Colon => {
|
Colon => {
|
||||||
text_state.push_str(":");
|
text_state.push(':');
|
||||||
}
|
}
|
||||||
Period | Decimal => {
|
Period | Decimal => {
|
||||||
text_state.push_str(".");
|
text_state.push('.');
|
||||||
}
|
}
|
||||||
Equals | NumpadEquals => {
|
Equals | NumpadEquals => {
|
||||||
text_state.push_str("=");
|
text_state.push('=');
|
||||||
}
|
}
|
||||||
Grave => {
|
Grave => {
|
||||||
text_state.push_str("`");
|
text_state.push('`');
|
||||||
}
|
}
|
||||||
Minus | Subtract => {
|
Minus | Subtract => {
|
||||||
text_state.push_str("-");
|
text_state.push('-');
|
||||||
}
|
}
|
||||||
Multiply => {
|
Multiply => {
|
||||||
text_state.push_str("*");
|
text_state.push('*');
|
||||||
}
|
}
|
||||||
Semicolon => {
|
Semicolon => {
|
||||||
text_state.push_str(";");
|
text_state.push(';');
|
||||||
}
|
}
|
||||||
Slash | Divide => {
|
Slash | Divide => {
|
||||||
text_state.push_str("/");
|
text_state.push('/');
|
||||||
}
|
}
|
||||||
Underline => {
|
Underline => {
|
||||||
text_state.push_str("_");
|
text_state.push('_');
|
||||||
}
|
}
|
||||||
Yen => {
|
Yen => {
|
||||||
text_state.push_str("¥");
|
text_state.push('¥');
|
||||||
}
|
}
|
||||||
Copy => {
|
Copy => {
|
||||||
todo!("copy");
|
todo!("copy");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue