@@ -686,13 +686,7 @@ impl<'c> Translation<'c> {
686
686
let mut tokens: Vec < TokenTree > = vec ! [ ] ;
687
687
688
688
let mut tied_operands = HashMap :: new ( ) ;
689
- for (
690
- input_idx,
691
- & AsmOperand {
692
- ref constraints, ..
693
- } ,
694
- ) in inputs. iter ( ) . enumerate ( )
695
- {
689
+ for ( input_idx, AsmOperand { constraints, .. } ) in inputs. iter ( ) . enumerate ( ) {
696
690
let constraints_digits = constraints. trim_matches ( |c : char | !c. is_ascii_digit ( ) ) ;
697
691
if let Ok ( output_idx) = constraints_digits. parse :: < usize > ( ) {
698
692
let output_key = ( output_idx, true ) ;
@@ -721,10 +715,9 @@ impl<'c> Translation<'c> {
721
715
if let Ok ( idx) = ref_str. parse :: < usize > ( ) {
722
716
outputs
723
717
. iter ( )
724
- . chain ( inputs. iter ( ) )
718
+ . chain ( inputs)
725
719
. nth ( idx)
726
- . map ( operand_is_mem_only)
727
- . unwrap_or ( false )
720
+ . map_or ( false , operand_is_mem_only)
728
721
} else {
729
722
false
730
723
}
@@ -757,13 +750,12 @@ impl<'c> Translation<'c> {
757
750
Ok ( ( mut dir_spec, mem_only, parsed) ) => {
758
751
// Add to args list; if a matching in_expr is found, this is
759
752
// an inout and we remove the output from the outputs list
760
- let mut in_expr = inputs_by_register. remove ( & parsed ) ;
761
- if in_expr . is_none ( ) {
753
+ let in_expr = inputs_by_register
754
+ . remove ( & parsed )
762
755
// Also check for by-index references to this output
763
- in_expr = inputs_by_register. remove ( & i. to_string ( ) ) ;
764
- }
765
- // Extract expression
766
- let in_expr = in_expr. map ( |( i, operand) | ( i, operand. expression ) ) ;
756
+ . or_else ( || inputs_by_register. remove ( & i. to_string ( ) ) )
757
+ // Extract expression
758
+ . map ( |( i, operand) | ( i, operand. expression ) ) ;
767
759
768
760
// For inouts, change the dirspec to include 'in'
769
761
if in_expr. is_some ( ) {
@@ -1026,7 +1018,7 @@ impl<'c> Translation<'c> {
1026
1018
stmts. push ( mac) ;
1027
1019
1028
1020
// Push the post-macro statements
1029
- stmts. extend ( post_stmts. into_iter ( ) ) ;
1021
+ stmts. extend ( post_stmts) ;
1030
1022
1031
1023
Ok ( stmts)
1032
1024
}
0 commit comments