Make clippy happy

This commit is contained in:
Brendan Hansknecht 2020-10-13 20:26:00 -07:00
parent 26978b58b4
commit eb7e39bf7b
5 changed files with 68 additions and 74 deletions

View file

@ -48,7 +48,7 @@ pub fn build_file(
buf.push_str(" ");
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, "Parse header", module_timing.parse_header);

View file

@ -89,13 +89,7 @@ impl Default for Pools {
impl Pools {
pub fn new(num_pools: usize) -> Self {
let mut pools = Vec::with_capacity(num_pools);
for _ in 0..num_pools {
pools.push(Vec::new());
}
Pools(pools)
Pools(vec![Vec::new(); num_pools])
}
pub fn len(&self) -> usize {

View file

@ -676,7 +676,7 @@ fn write_boolean(env: &Env, boolean: Bool, subs: &Subs, buf: &mut String, parens
let combined = buffers.join(" | ");
buf.push_str("(");
buf.push('(');
write_content(
env,
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(&combined);
buf.push_str(")");
buf.push(')');
}
}
}
@ -716,7 +716,7 @@ fn write_apply(
let mut default_case = |subs, content| {
if write_parens {
buf.push_str("(");
buf.push('(');
}
write_content(env, content, subs, &mut arg_param, Parens::InTypeParam);
@ -724,7 +724,7 @@ fn write_apply(
buf.push_str(&arg_param);
if write_parens {
buf.push_str(")");
buf.push(')');
}
};
@ -762,13 +762,13 @@ fn write_apply(
}
_ => {
if write_parens {
buf.push_str("(");
buf.push('(');
}
write_symbol(env, symbol, buf);
for arg in args {
buf.push_str(" ");
buf.push(' ');
write_content(
env,
subs.get_without_compacting(arg).content,
@ -779,7 +779,7 @@ fn write_apply(
}
if write_parens {
buf.push_str(")");
buf.push(')');
}
}
}
@ -797,7 +797,7 @@ fn write_fn(
let use_parens = parens != Parens::Unnecessary;
if use_parens {
buf.push_str("(");
buf.push('(');
}
for arg in args {
@ -826,7 +826,7 @@ fn write_fn(
);
if use_parens {
buf.push_str(")");
buf.push(')');
}
}

View file

@ -1063,7 +1063,7 @@ fn write_error_type_help(
match error_type {
Infinite => buf.push_str(""),
Error => buf.push_str("?"),
Error => buf.push('?'),
FlexVar(name) => buf.push_str(name.as_str()),
RigidVar(name) => buf.push_str(name.as_str()),
Type(symbol, arguments) => {
@ -1181,7 +1181,7 @@ fn write_debug_error_type_help(error_type: ErrorType, buf: &mut String, parens:
match error_type {
Infinite => buf.push_str(""),
Error => buf.push_str("?"),
Error => buf.push('?'),
FlexVar(name) => buf.push_str(name.as_str()),
RigidVar(name) => buf.push_str(name.as_str()),
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() {
buf.push_str(&format!("{:?}", tag));
for arg in args {
buf.push_str(" ");
buf.push(' ');
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() {
buf.push_str(&format!("{:?}", tag));
for arg in args {
buf.push_str(" ");
buf.push(' ');
write_debug_error_type_help(arg, buf, Parens::Unnecessary);
}

View file

@ -13,42 +13,42 @@ pub fn handle_text_input(
}
match virtual_keycode {
Key1 | Numpad1 => text_state.push_str("1"),
Key2 | Numpad2 => text_state.push_str("2"),
Key3 | Numpad3 => text_state.push_str("3"),
Key4 | Numpad4 => text_state.push_str("4"),
Key5 | Numpad5 => text_state.push_str("5"),
Key6 | Numpad6 => text_state.push_str("6"),
Key7 | Numpad7 => text_state.push_str("7"),
Key8 | Numpad8 => text_state.push_str("8"),
Key9 | Numpad9 => text_state.push_str("9"),
Key0 | Numpad0 => text_state.push_str("0"),
A => text_state.push_str("a"),
B => text_state.push_str("b"),
C => text_state.push_str("c"),
D => text_state.push_str("d"),
E => text_state.push_str("e"),
F => text_state.push_str("f"),
G => text_state.push_str("g"),
H => text_state.push_str("h"),
I => text_state.push_str("i"),
J => text_state.push_str("j"),
K => text_state.push_str("k"),
L => text_state.push_str("l"),
M => text_state.push_str("m"),
N => text_state.push_str("n"),
O => text_state.push_str("o"),
P => text_state.push_str("p"),
Q => text_state.push_str("q"),
R => text_state.push_str("r"),
S => text_state.push_str("s"),
T => text_state.push_str("t"),
U => text_state.push_str("u"),
V => text_state.push_str("v"),
W => text_state.push_str("w"),
X => text_state.push_str("x"),
Y => text_state.push_str("y"),
Z => text_state.push_str("z"),
Key1 | Numpad1 => text_state.push('1'),
Key2 | Numpad2 => text_state.push('2'),
Key3 | Numpad3 => text_state.push('3'),
Key4 | Numpad4 => text_state.push('4'),
Key5 | Numpad5 => text_state.push('5'),
Key6 | Numpad6 => text_state.push('6'),
Key7 | Numpad7 => text_state.push('7'),
Key8 | Numpad8 => text_state.push('8'),
Key9 | Numpad9 => text_state.push('9'),
Key0 | Numpad0 => text_state.push('0'),
A => text_state.push('a'),
B => text_state.push('b'),
C => text_state.push('c'),
D => text_state.push('d'),
E => text_state.push('e'),
F => text_state.push('f'),
G => text_state.push('g'),
H => text_state.push('h'),
I => text_state.push('i'),
J => text_state.push('j'),
K => text_state.push('k'),
L => text_state.push('l'),
M => text_state.push('m'),
N => text_state.push('n'),
O => text_state.push('o'),
P => text_state.push('p'),
Q => text_state.push('q'),
R => text_state.push('r'),
S => text_state.push('s'),
T => text_state.push('t'),
U => text_state.push('u'),
V => text_state.push('v'),
W => text_state.push('w'),
X => text_state.push('x'),
Y => text_state.push('y'),
Z => text_state.push('z'),
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
| Insert | Home | Delete | End | PageDown | PageUp | Left | Up | Right | Down | Compose
@ -65,55 +65,55 @@ pub fn handle_text_input(
text_state.pop();
}
Return | NumpadEnter => {
text_state.push_str("\n");
text_state.push('\n');
}
Space => {
text_state.push_str(" ");
text_state.push(' ');
}
Comma | NumpadComma => {
text_state.push_str(",");
text_state.push(',');
}
Add => {
text_state.push_str("+");
text_state.push('+');
}
Apostrophe => {
text_state.push_str("'");
text_state.push('\'');
}
At => {
text_state.push_str("@");
text_state.push('@');
}
Backslash => {
text_state.push_str("\\");
text_state.push('\\');
}
Colon => {
text_state.push_str(":");
text_state.push(':');
}
Period | Decimal => {
text_state.push_str(".");
text_state.push('.');
}
Equals | NumpadEquals => {
text_state.push_str("=");
text_state.push('=');
}
Grave => {
text_state.push_str("`");
text_state.push('`');
}
Minus | Subtract => {
text_state.push_str("-");
text_state.push('-');
}
Multiply => {
text_state.push_str("*");
text_state.push('*');
}
Semicolon => {
text_state.push_str(";");
text_state.push(';');
}
Slash | Divide => {
text_state.push_str("/");
text_state.push('/');
}
Underline => {
text_state.push_str("_");
text_state.push('_');
}
Yen => {
text_state.push_str("¥");
text_state.push('¥');
}
Copy => {
todo!("copy");