@@ -89,16 +89,16 @@ fn build_pin(builder: &mut Builder, cx: &mut ExtCtxt, node: Rc<node::Node>) {
8989 None => "GPIO" . to_string ( ) ,
9090 Some ( fun) => {
9191 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 => {
9595 cx. parse_sess ( ) . span_diagnostic . span_err (
9696 node. get_attr ( "function" ) . value_span ,
9797 format ! ( "unknown pin function `{}`, only GPIO avaliable on this pin" ,
9898 fun) . as_slice ( ) ) ;
9999 return ;
100100 }
101- & Some ( ref pin_funcs) => {
101+ Some ( ref pin_funcs) => {
102102 let maybe_func = pin_funcs. find ( & fun) ;
103103 match maybe_func {
104104 None => {
@@ -152,7 +152,7 @@ mod test {
152152 assert ! ( unsafe { * failed} == false ) ;
153153 assert ! ( builder. main_stmts( ) . len( ) == 1 ) ;
154154
155- assert_equal_source ( builder. main_stmts ( ) . get ( 0 ) ,
155+ assert_equal_source ( builder. main_stmts ( ) [ 0 ] ,
156156 "let p1 = zinc::hal::lpc17xx::pin::Pin::new(
157157 zinc::hal::lpc17xx::pin::Port0,
158158 1u8,
@@ -174,7 +174,7 @@ mod test {
174174 assert ! ( unsafe { * failed} == false ) ;
175175 assert ! ( builder. main_stmts( ) . len( ) == 1 ) ;
176176
177- assert_equal_source ( builder. main_stmts ( ) . get ( 0 ) ,
177+ assert_equal_source ( builder. main_stmts ( ) [ 0 ] ,
178178 "let p2 = zinc::hal::lpc17xx::pin::Pin::new(
179179 zinc::hal::lpc17xx::pin::Port0,
180180 2u8,
@@ -196,7 +196,7 @@ mod test {
196196 assert ! ( unsafe { * failed} == false ) ;
197197 assert ! ( builder. main_stmts( ) . len( ) == 1 ) ;
198198
199- assert_equal_source ( builder. main_stmts ( ) . get ( 0 ) ,
199+ assert_equal_source ( builder. main_stmts ( ) [ 0 ] ,
200200 "let p3 = zinc::hal::lpc17xx::pin::Pin::new(
201201 zinc::hal::lpc17xx::pin::Port0,
202202 3u8,
0 commit comments