@@ -19,10 +19,10 @@ pub(crate) mod printf {
19
19
}
20
20
}
21
21
22
- pub fn position ( & self ) -> Option < InnerSpan > {
22
+ pub fn position ( & self ) -> InnerSpan {
23
23
match self {
24
- Substitution :: Format ( fmt) => Some ( fmt. position ) ,
25
- & Substitution :: Escape ( ( start, end) ) => Some ( InnerSpan :: new ( start, end) ) ,
24
+ Substitution :: Format ( fmt) => fmt. position ,
25
+ & Substitution :: Escape ( ( start, end) ) => InnerSpan :: new ( start, end) ,
26
26
}
27
27
}
28
28
@@ -302,10 +302,9 @@ pub(crate) mod printf {
302
302
fn next ( & mut self ) -> Option < Self :: Item > {
303
303
let ( mut sub, tail) = parse_next_substitution ( self . s ) ?;
304
304
self . s = tail;
305
- if let Some ( InnerSpan { start, end } ) = sub. position ( ) {
306
- sub. set_position ( start + self . pos , end + self . pos ) ;
307
- self . pos += end;
308
- }
305
+ let InnerSpan { start, end } = sub. position ( ) ;
306
+ sub. set_position ( start + self . pos , end + self . pos ) ;
307
+ self . pos += end;
309
308
Some ( sub)
310
309
}
311
310
@@ -629,9 +628,9 @@ pub mod shell {
629
628
}
630
629
}
631
630
632
- pub fn position ( & self ) -> Option < InnerSpan > {
631
+ pub fn position ( & self ) -> InnerSpan {
633
632
let ( Self :: Ordinal ( _, pos) | Self :: Name ( _, pos) | Self :: Escape ( pos) ) = self ;
634
- Some ( InnerSpan :: new ( pos. 0 , pos. 1 ) )
633
+ InnerSpan :: new ( pos. 0 , pos. 1 )
635
634
}
636
635
637
636
pub fn set_position ( & mut self , start : usize , end : usize ) {
@@ -664,10 +663,9 @@ pub mod shell {
664
663
fn next ( & mut self ) -> Option < Self :: Item > {
665
664
let ( mut sub, tail) = parse_next_substitution ( self . s ) ?;
666
665
self . s = tail;
667
- if let Some ( InnerSpan { start, end } ) = sub. position ( ) {
668
- sub. set_position ( start + self . pos , end + self . pos ) ;
669
- self . pos += end;
670
- }
666
+ let InnerSpan { start, end } = sub. position ( ) ;
667
+ sub. set_position ( start + self . pos , end + self . pos ) ;
668
+ self . pos += end;
671
669
Some ( sub)
672
670
}
673
671
0 commit comments