@@ -468,7 +468,7 @@ fn matches(rust: &Function, arm: &Intrinsic) -> Result<(), String> {
468
468
}
469
469
// sometimes arm says `foo` and disassemblers say `vfoo`, or
470
470
// sometimes disassemblers say `vfoo` and arm says `sfoo` or `ffoo`
471
- if instr. starts_with ( "v" )
471
+ if instr. starts_with ( 'v' )
472
472
&& ( arm. instruction . starts_with ( & instr[ 1 ..] )
473
473
|| arm. instruction [ 1 ..] . starts_with ( & instr[ 1 ..] ) )
474
474
{
@@ -491,10 +491,10 @@ fn matches(rust: &Function, arm: &Intrinsic) -> Result<(), String> {
491
491
fn find_accordion ( node : & Rc < Node > ) -> Option < Rc < Node > > {
492
492
if let NodeData :: Element { attrs, .. } = & node. data {
493
493
for attr in attrs. borrow ( ) . iter ( ) {
494
- if attr. name . local . eq_str_ignore_ascii_case ( "class" ) {
495
- if attr. value . to_string ( ) == "intrinsic-accordion" {
496
- return Some ( node . clone ( ) ) ;
497
- }
494
+ if attr. name . local . eq_str_ignore_ascii_case ( "class" )
495
+ && attr. value . to_string ( ) == "intrinsic-accordion"
496
+ {
497
+ return Some ( node . clone ( ) ) ;
498
498
}
499
499
}
500
500
}
@@ -522,7 +522,7 @@ fn parse_intrinsics(node: &Rc<Node>) -> HashMap<String, Intrinsic> {
522
522
ret. insert ( f. name . clone ( ) , f) ;
523
523
}
524
524
}
525
- return ret;
525
+ ret
526
526
}
527
527
528
528
fn parse_intrinsic ( node : & Rc < Node > ) -> Intrinsic {
@@ -535,10 +535,9 @@ fn parse_intrinsic(node: &Rc<Node>) -> Intrinsic {
535
535
// ...
536
536
537
537
let children = node. children . borrow ( ) ;
538
- let mut children = children. iter ( ) . filter ( |node| match node. data {
539
- NodeData :: Element { .. } => true ,
540
- _ => false ,
541
- } ) ;
538
+ let mut children = children
539
+ . iter ( )
540
+ . filter ( |node| matches ! ( node. data, NodeData :: Element { .. } ) ) ;
542
541
let _input = children. next ( ) . expect ( "no <input>" ) ;
543
542
let label = children. next ( ) . expect ( "no <label>" ) ;
544
543
let article = children. next ( ) . expect ( "no <article>" ) ;
@@ -558,10 +557,9 @@ fn parse_intrinsic(node: &Rc<Node>) -> Intrinsic {
558
557
559
558
// Find contents of inner `<div>` in `<label>`
560
559
let label_children = label. children . borrow ( ) ;
561
- let mut label_children = label_children. iter ( ) . filter ( |node| match node. data {
562
- NodeData :: Element { .. } => true ,
563
- _ => false ,
564
- } ) ;
560
+ let mut label_children = label_children
561
+ . iter ( )
562
+ . filter ( |node| matches ! ( node. data, NodeData :: Element { .. } ) ) ;
565
563
let label_div = label_children. next ( ) . expect ( "no <div> in <label>" ) ;
566
564
assert ! ( label_children. next( ) . is_none( ) ) ;
567
565
let text = label_div. children . borrow ( ) ;
@@ -577,10 +575,9 @@ fn parse_intrinsic(node: &Rc<Node>) -> Intrinsic {
577
575
578
576
// Find the instruction within the article
579
577
let article_children = article. children . borrow ( ) ;
580
- let mut article_children = article_children. iter ( ) . filter ( |node| match node. data {
581
- NodeData :: Element { .. } => true ,
582
- _ => false ,
583
- } ) ;
578
+ let mut article_children = article_children
579
+ . iter ( )
580
+ . filter ( |node| matches ! ( node. data, NodeData :: Element { .. } ) ) ;
584
581
let mut instruction = None ;
585
582
while let Some ( child) = article_children. next ( ) {
586
583
let mut header = String :: new ( ) ;
@@ -609,9 +606,9 @@ fn parse_intrinsic(node: &Rc<Node>) -> Intrinsic {
609
606
} ,
610
607
instruction,
611
608
arguments : args // "(...)"
612
- . trim_start_matches ( "(" ) // "...)"
613
- . trim_end_matches ( ")" ) // "..."
614
- . split ( "," ) // " Type name ", ".."
609
+ . trim_start_matches ( '(' ) // "...)"
610
+ . trim_end_matches ( ')' ) // "..."
611
+ . split ( ',' ) // " Type name ", ".."
615
612
. map ( |s| s. trim ( ) ) // "Type name"
616
613
. map ( |s| s. rsplitn ( 2 , ' ' ) . nth ( 1 ) . unwrap ( ) ) // "Type"
617
614
. map ( |s| {
@@ -775,7 +772,7 @@ fn parse_ty_base(s: &str) -> &'static Type {
775
772
776
773
fn collect_text ( s : & mut String , node : & Node ) {
777
774
if let NodeData :: Text { contents } = & node. data {
778
- s. push_str ( " " ) ;
775
+ s. push ( ' ' ) ;
779
776
s. push_str ( & contents. borrow ( ) . to_string ( ) ) ;
780
777
}
781
778
for child in node. children . borrow ( ) . iter ( ) {
0 commit comments