@@ -19,10 +19,10 @@ pub(crate) mod printf {
1919 }
2020 }
2121
22- pub fn position ( & self ) -> Option < InnerSpan > {
22+ pub fn position ( & self ) -> InnerSpan {
2323 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) ,
2626 }
2727 }
2828
@@ -302,10 +302,9 @@ pub(crate) mod printf {
302302 fn next ( & mut self ) -> Option < Self :: Item > {
303303 let ( mut sub, tail) = parse_next_substitution ( self . s ) ?;
304304 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;
309308 Some ( sub)
310309 }
311310
@@ -629,9 +628,9 @@ pub mod shell {
629628 }
630629 }
631630
632- pub fn position ( & self ) -> Option < InnerSpan > {
631+ pub fn position ( & self ) -> InnerSpan {
633632 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 )
635634 }
636635
637636 pub fn set_position ( & mut self , start : usize , end : usize ) {
@@ -664,10 +663,9 @@ pub mod shell {
664663 fn next ( & mut self ) -> Option < Self :: Item > {
665664 let ( mut sub, tail) = parse_next_substitution ( self . s ) ?;
666665 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;
671669 Some ( sub)
672670 }
673671
0 commit comments