Skip to content

Commit 10cb01d

Browse files
clippy: correct clippy in plot utils
1 parent 6b1e715 commit 10cb01d

File tree

3 files changed

+11
-16
lines changed

3 files changed

+11
-16
lines changed

src/interpreting/stdlib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2246,7 +2246,7 @@ pub fn plot_fn(
22462246
if !terminal {
22472247
f.show().unwrap();
22482248
} else {
2249-
computes_lines(&x, &y, st, end, steps, title, xlabel, ylabel);
2249+
computes_lines(&x, &y, st, end, title, xlabel, ylabel);
22502250
}
22512251
Null
22522252
}

src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -593,18 +593,18 @@ impl<Term: Terminal> Completer<Term> for CalcCompleter {
593593
Some(co)
594594
}
595595

596-
Some("toggle_float") => match words.next() {
597-
_ => {
596+
Some("toggle_float") => {
597+
words.next();
598+
{
598599
let mut co = Vec::new();
599600
for cmd in TOGGLE_FLOAT_CMD {
600601
if cmd.starts_with(word) {
601602
co.push(Completion::simple(cmd.to_string()));
602603
}
603604
}
604-
605605
Some(co)
606606
}
607-
},
607+
}
608608

609609
Some("config") => match words.next() {
610610
None => {

src/utils/plot_utils.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
pub fn computes_lines(
2-
x: &Vec<f64>,
3-
y: &Vec<f64>,
2+
x: &[f64],
3+
y: &[f64],
44
start: f64,
55
end: f64,
6-
_steps: f64,
76
title: String,
87
xlabel: String,
98
ylabel: String,
@@ -94,15 +93,11 @@ pub fn computes_lines(
9493
for s in string_ymax.replace("-", "|").chars().rev() {
9594
y_sized.push(s);
9695
}
97-
for _ in (lsize)..(30 / 2) {
98-
y_sized.push(' ');
99-
}
96+
y_sized.extend(std::iter::repeat_n(' ', 15 - (lsize)));
10097
for s in ymiddle.replace("-", "|").chars().rev() {
10198
y_sized.push(s);
10299
}
103-
for _ in ymiddle_size..(30 / 2 - lminsize) {
104-
y_sized.push(' ');
105-
}
100+
y_sized.extend(std::iter::repeat_n(' ', 15 - lminsize - ymiddle_size));
106101
for s in lmin_string.replace("-", "|").chars().rev() {
107102
y_sized.push(s);
108103
}
@@ -114,8 +109,8 @@ pub fn computes_lines(
114109
print!("{}", iter_y_sized.next().unwrap());
115110
print!("|");
116111
let xs = &bitmap[x];
117-
for y in 0..xs.len() {
118-
print!("{}", xs[y]);
112+
for item in xs {
113+
print!("{}", item);
119114
}
120115
println!("*");
121116
}

0 commit comments

Comments
 (0)