Skip to content

Commit 36b06fc

Browse files
committed
clippy + formatting for Rust 1.80
1 parent a2daff9 commit 36b06fc

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

lib/src/turtle/g_code.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl<'input> Turtle for GCodeTurtle<'input> {
9090
fn move_to(&mut self, to: Point<f64>) {
9191
self.tool_off();
9292
self.program
93-
.append(&mut command!(RapidPositioning { X: to.x, Y: to.y, }).into_token_vec());
93+
.append(&mut command!(RapidPositioning { X: to.x, Y: to.y }).into_token_vec());
9494
}
9595

9696
fn line_to(&mut self, to: Point<f64>) {

lib/src/turtle/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl<T: Turtle + std::fmt::Debug> Terrarium<T> {
9797
// which could result in a G91 G1 X0 Y0
9898
if !(self.current_position - self.initial_position)
9999
.abs()
100-
.lower_than(vector(std::f64::EPSILON, std::f64::EPSILON))
100+
.lower_than(vector(f64::EPSILON, f64::EPSILON))
101101
.all()
102102
{
103103
self.turtle.line_to(self.initial_position);

web/src/ui/mod.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,23 @@ macro_rules! css_class_enum {
2020
),*
2121
}
2222

23-
impl ToString for $name {
24-
fn to_string(&self) -> String {
23+
impl std::fmt::Display for $name {
24+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2525
let suffix = match self {
2626
$(
2727
Self::$variant => $class
2828
),*
2929
};
30-
if suffix.is_empty() {
31-
String::default()
32-
} else {
33-
let mut acc = String::default();
30+
if !suffix.is_empty() {
3431
$(
35-
acc += $prefix;
36-
acc.push('-');
32+
write!(f, "{}-", $prefix)?;
3733
)?
38-
acc += suffix;
39-
acc
34+
write!(f, "{suffix}")
35+
} else {
36+
Ok(())
4037
}
4138
}
39+
4240
}
4341
};
4442
}

0 commit comments

Comments
 (0)