File tree Expand file tree Collapse file tree 3 files changed +10
-12
lines changed
Expand file tree Collapse file tree 3 files changed +10
-12
lines changed Original file line number Diff line number Diff 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 > ) {
Original file line number Diff line number Diff 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 ) ;
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments