@@ -33,31 +33,25 @@ pub struct Decompositions<I> {
3333 // to sort in canonical order and is not safe to emit.
3434 buffer : SmallVec < [ ( u8 , char ) ; 4 ] > ,
3535 ready : Range < usize > ,
36-
37- // The only purpose of this field is to prevent us calling `next` on an
38- // exhausted iterator; otherwise it would be redundant.
39- done : bool ,
4036}
4137
4238#[ inline]
43- pub fn new_canonical < I : Iterator < Item = char > > ( iter : I ) -> Decompositions < I > {
39+ pub fn new_canonical < I : Iterator < Item = char > > ( iter : I ) -> Decompositions < I > {
4440 Decompositions {
4541 kind : self :: DecompositionType :: Canonical ,
4642 iter : iter,
4743 buffer : SmallVec :: new ( ) ,
4844 ready : 0 ..0 ,
49- done : false ,
5045 }
5146}
5247
5348#[ inline]
54- pub fn new_compatible < I : Iterator < Item = char > > ( iter : I ) -> Decompositions < I > {
49+ pub fn new_compatible < I : Iterator < Item = char > > ( iter : I ) -> Decompositions < I > {
5550 Decompositions {
5651 kind : self :: DecompositionType :: Compatible ,
5752 iter : iter,
5853 buffer : SmallVec :: new ( ) ,
5954 ready : 0 ..0 ,
60- done : false ,
6155 }
6256}
6357
@@ -104,14 +98,13 @@ impl<I> Decompositions<I> {
10498 }
10599}
106100
107- impl < I : Iterator < Item = char > > Iterator for Decompositions < I > {
101+ impl < I : Iterator < Item = char > > Iterator for Decompositions < I > {
108102 type Item = char ;
109103
110104 #[ inline]
111105 fn next ( & mut self ) -> Option < char > {
112106 while self . ready . end == 0 {
113- let next = if self . done { None } else { self . iter . next ( ) } ;
114- match ( next, & self . kind ) {
107+ match ( self . iter . next ( ) , & self . kind ) {
115108 ( Some ( ch) , & DecompositionType :: Canonical ) => {
116109 super :: char:: decompose_canonical ( ch, |d| self . push_back ( d) ) ;
117110 }
@@ -123,7 +116,6 @@ impl<I: Iterator<Item = char>> Iterator for Decompositions<I> {
123116 return None ;
124117 } else {
125118 self . sort_pending ( ) ;
126- self . done = true ;
127119 break ;
128120 }
129121 }
@@ -141,7 +133,7 @@ impl<I: Iterator<Item = char>> Iterator for Decompositions<I> {
141133 }
142134}
143135
144- impl < I : Iterator < Item = char > + Clone > fmt:: Display for Decompositions < I > {
136+ impl < I : Iterator < Item = char > + Clone > fmt:: Display for Decompositions < I > {
145137 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
146138 for c in self . clone ( ) {
147139 f. write_char ( c) ?;
0 commit comments