@@ -89,16 +89,16 @@ fn build_pin(builder: &mut Builder, cx: &mut ExtCtxt, node: Rc<node::Node>) {
89
89
None => "GPIO" . to_string ( ) ,
90
90
Some ( fun) => {
91
91
let pins = port_def. get ( port_path) ;
92
- let maybe_pin = pins . get ( from_str ( node. path . as_slice ( ) ) . unwrap ( ) ) ;
93
- match maybe_pin {
94
- & None => {
92
+ let maybe_pin_index = from_str ( node. path . as_slice ( ) ) . unwrap ( ) ;
93
+ match pins [ maybe_pin_index ] {
94
+ None => {
95
95
cx. parse_sess ( ) . span_diagnostic . span_err (
96
96
node. get_attr ( "function" ) . value_span ,
97
97
format ! ( "unknown pin function `{}`, only GPIO avaliable on this pin" ,
98
98
fun) . as_slice ( ) ) ;
99
99
return ;
100
100
}
101
- & Some ( ref pin_funcs) => {
101
+ Some ( ref pin_funcs) => {
102
102
let maybe_func = pin_funcs. find ( & fun) ;
103
103
match maybe_func {
104
104
None => {
@@ -152,7 +152,7 @@ mod test {
152
152
assert ! ( unsafe { * failed} == false ) ;
153
153
assert ! ( builder. main_stmts( ) . len( ) == 1 ) ;
154
154
155
- assert_equal_source ( builder. main_stmts ( ) . get ( 0 ) ,
155
+ assert_equal_source ( builder. main_stmts ( ) [ 0 ] ,
156
156
"let p1 = zinc::hal::lpc17xx::pin::Pin::new(
157
157
zinc::hal::lpc17xx::pin::Port0,
158
158
1u8,
@@ -174,7 +174,7 @@ mod test {
174
174
assert ! ( unsafe { * failed} == false ) ;
175
175
assert ! ( builder. main_stmts( ) . len( ) == 1 ) ;
176
176
177
- assert_equal_source ( builder. main_stmts ( ) . get ( 0 ) ,
177
+ assert_equal_source ( builder. main_stmts ( ) [ 0 ] ,
178
178
"let p2 = zinc::hal::lpc17xx::pin::Pin::new(
179
179
zinc::hal::lpc17xx::pin::Port0,
180
180
2u8,
@@ -196,7 +196,7 @@ mod test {
196
196
assert ! ( unsafe { * failed} == false ) ;
197
197
assert ! ( builder. main_stmts( ) . len( ) == 1 ) ;
198
198
199
- assert_equal_source ( builder. main_stmts ( ) . get ( 0 ) ,
199
+ assert_equal_source ( builder. main_stmts ( ) [ 0 ] ,
200
200
"let p3 = zinc::hal::lpc17xx::pin::Pin::new(
201
201
zinc::hal::lpc17xx::pin::Port0,
202
202
3u8,
0 commit comments