@@ -27,80 +27,80 @@ fn main() {
2727 ] ;
2828
2929 let right = {
30- let mut pxs = background_pixels. clone ( ) ;
31- pxs[ 31 ] = & red_px;
32- pxs[ 39 ] = & red_px;
33- pxs
30+ let mut pxs = background_pixels. clone ( ) ;
31+ pxs[ 31 ] = & red_px;
32+ pxs[ 39 ] = & red_px;
33+ pxs
3434 } ;
3535 let right_up = {
36- let mut pxs = background_pixels. clone ( ) ;
37- pxs[ 14 ] = & red_px;
38- pxs[ 23 ] = & red_px;
39- pxs
36+ let mut pxs = background_pixels. clone ( ) ;
37+ pxs[ 14 ] = & red_px;
38+ pxs[ 23 ] = & red_px;
39+ pxs
4040 } ;
4141 let right_down = {
42- let mut pxs = background_pixels. clone ( ) ;
43- pxs[ 47 ] = & red_px;
44- pxs[ 54 ] = & red_px;
45- pxs
42+ let mut pxs = background_pixels. clone ( ) ;
43+ pxs[ 47 ] = & red_px;
44+ pxs[ 54 ] = & red_px;
45+ pxs
4646 } ;
4747
4848 let up = {
49- let mut pxs = background_pixels. clone ( ) ;
50- pxs[ 3 ] = & red_px;
51- pxs[ 4 ] = & red_px;
52- pxs
49+ let mut pxs = background_pixels. clone ( ) ;
50+ pxs[ 3 ] = & red_px;
51+ pxs[ 4 ] = & red_px;
52+ pxs
5353 } ;
5454
5555 let up_left = {
56- let mut pxs = background_pixels. clone ( ) ;
57- pxs[ 2 ] = & red_px;
58- pxs[ 9 ] = & red_px;
59- pxs
56+ let mut pxs = background_pixels. clone ( ) ;
57+ pxs[ 2 ] = & red_px;
58+ pxs[ 9 ] = & red_px;
59+ pxs
6060 } ;
6161 let up_right = {
62- let mut pxs = background_pixels. clone ( ) ;
63- pxs[ 5 ] = & red_px;
64- pxs[ 14 ] = & red_px;
65- pxs
62+ let mut pxs = background_pixels. clone ( ) ;
63+ pxs[ 5 ] = & red_px;
64+ pxs[ 14 ] = & red_px;
65+ pxs
6666 } ;
6767
6868 let left = {
69- let mut pxs = background_pixels. clone ( ) ;
70- pxs[ 24 ] = & red_px;
71- pxs[ 32 ] = & red_px;
72- pxs
69+ let mut pxs = background_pixels. clone ( ) ;
70+ pxs[ 24 ] = & red_px;
71+ pxs[ 32 ] = & red_px;
72+ pxs
7373 } ;
7474 let left_up = {
75- let mut pxs = background_pixels. clone ( ) ;
76- pxs[ 9 ] = & red_px;
77- pxs[ 16 ] = & red_px;
78- pxs
75+ let mut pxs = background_pixels. clone ( ) ;
76+ pxs[ 9 ] = & red_px;
77+ pxs[ 16 ] = & red_px;
78+ pxs
7979 } ;
8080 let left_down = {
81- let mut pxs = background_pixels. clone ( ) ;
82- pxs[ 40 ] = & red_px;
83- pxs[ 49 ] = & red_px;
84- pxs
81+ let mut pxs = background_pixels. clone ( ) ;
82+ pxs[ 40 ] = & red_px;
83+ pxs[ 49 ] = & red_px;
84+ pxs
8585 } ;
8686
8787 let down = {
88- let mut pxs = background_pixels. clone ( ) ;
89- pxs[ 59 ] = & red_px;
90- pxs[ 60 ] = & red_px;
91- pxs
88+ let mut pxs = background_pixels. clone ( ) ;
89+ pxs[ 59 ] = & red_px;
90+ pxs[ 60 ] = & red_px;
91+ pxs
9292 } ;
9393 let down_left = {
94- let mut pxs = background_pixels. clone ( ) ;
95- pxs[ 49 ] = & red_px;
96- pxs[ 58 ] = & red_px;
97- pxs
94+ let mut pxs = background_pixels. clone ( ) ;
95+ pxs[ 49 ] = & red_px;
96+ pxs[ 58 ] = & red_px;
97+ pxs
9898 } ;
9999 let down_right = {
100- let mut pxs = background_pixels. clone ( ) ;
101- pxs[ 54 ] = & red_px;
102- pxs[ 61 ] = & red_px;
103- pxs
100+ let mut pxs = background_pixels. clone ( ) ;
101+ pxs[ 54 ] = & red_px;
102+ pxs[ 61 ] = & red_px;
103+ pxs
104104 } ;
105105 let bg_frame = FrameLine :: from_pixels ( & background_pixels) ;
106106 let left_frame = FrameLine :: from_pixels ( & left) ;
@@ -127,40 +127,42 @@ fn main() {
127127 match needle. as_degrees ( ) {
128128 angle if angle > -15.0 && angle <= 15.0 => {
129129 screen. write_frame ( & right_frame) ;
130- } ,
130+ }
131131 angle if angle > 15.0 && angle <= 45.0 => {
132132 screen. write_frame ( & right_up_frame) ;
133- } ,
133+ }
134134 angle if angle > 45.0 && angle <= 75.0 => {
135135 screen. write_frame ( & up_right_frame) ;
136- } ,
136+ }
137137 angle if angle > 75.0 && angle <= 105.0 => {
138138 screen. write_frame ( & up_frame) ;
139- } ,
139+ }
140140 angle if angle > 105.0 && angle <= 135.0 => {
141141 screen. write_frame ( & up_left_frame) ;
142- } ,
142+ }
143143 angle if angle > 135.0 && angle <= 165.0 => {
144144 screen. write_frame ( & left_up_frame) ;
145- } ,
146- angle if ( angle > 165.0 && angle <= 180.0 ) || ( angle < -165.0 && angle >= -180.0 ) => {
145+ }
146+ angle
147+ if ( angle > 165.0 && angle <= 180.0 ) || ( angle < -165.0 && angle >= -180.0 ) =>
148+ {
147149 screen. write_frame ( & left_frame) ;
148- } ,
150+ }
149151 angle if angle < -15.0 && angle >= -45.0 => {
150152 screen. write_frame ( & right_down_frame) ;
151- } ,
153+ }
152154 angle if angle < -45.0 && angle >= -75.0 => {
153155 screen. write_frame ( & down_right_frame) ;
154- } ,
156+ }
155157 angle if angle < -75.0 && angle >= -105.0 => {
156158 screen. write_frame ( & down_frame) ;
157- } ,
159+ }
158160 angle if angle < -105.0 && angle >= -135.0 => {
159161 screen. write_frame ( & down_left_frame) ;
160- } ,
162+ }
161163 angle if angle < -135.0 && angle >= -165.0 => {
162164 screen. write_frame ( & left_down_frame) ;
163- } ,
165+ }
164166 _ => screen. write_frame ( & bg_frame) ,
165167 }
166168 }
0 commit comments