@@ -132,7 +132,7 @@ impl Notetype {
132
132
/// always return the first and only template.
133
133
pub fn get_template ( & self , card_ord : u16 ) -> Result < & CardTemplate > {
134
134
let template = if self . config . kind ( ) == NotetypeKind :: Cloze {
135
- self . templates . get ( 0 )
135
+ self . templates . first ( )
136
136
} else {
137
137
self . templates . get ( card_ord as usize )
138
138
} ;
@@ -553,7 +553,7 @@ impl Notetype {
553
553
fields : HashMap < String , Option < String > > ,
554
554
parsed : & mut [ ( Option < ParsedTemplate > , Option < ParsedTemplate > ) ] ,
555
555
) {
556
- let first_remaining_field_name = & self . fields . get ( 0 ) . unwrap ( ) . name ;
556
+ let first_remaining_field_name = & self . fields . first ( ) . unwrap ( ) . name ;
557
557
let is_cloze = self . is_cloze ( ) ;
558
558
for ( idx, ( q_opt, a_opt) ) in parsed. iter_mut ( ) . enumerate ( ) {
559
559
if let Some ( q) = q_opt {
@@ -616,7 +616,7 @@ impl Notetype {
616
616
pub ( crate ) fn cloze_fields ( & self ) -> HashSet < usize > {
617
617
if !self . is_cloze ( ) {
618
618
HashSet :: new ( )
619
- } else if let Some ( ( Some ( front) , _) ) = self . parsed_templates ( ) . get ( 0 ) {
619
+ } else if let Some ( ( Some ( front) , _) ) = self . parsed_templates ( ) . first ( ) {
620
620
front
621
621
. all_referenced_cloze_field_names ( )
622
622
. iter ( )
@@ -647,7 +647,7 @@ fn missing_cloze_filter(
647
647
parsed_templates : & [ ( Option < ParsedTemplate > , Option < ParsedTemplate > ) ] ,
648
648
) -> bool {
649
649
parsed_templates
650
- . get ( 0 )
650
+ . first ( )
651
651
. map_or ( true , |t| !has_cloze ( & t. 0 ) || !has_cloze ( & t. 1 ) )
652
652
}
653
653
0 commit comments