@@ -12,14 +12,16 @@ pub(crate) mod printf {
12
12
Escape ( ( usize , usize ) ) ,
13
13
}
14
14
15
- impl < ' a > Substitution < ' a > {
16
- pub ( crate ) fn as_str ( & self ) -> & str {
15
+ impl ToString for Substitution < ' _ > {
16
+ fn to_string ( & self ) -> String {
17
17
match self {
18
- Substitution :: Format ( fmt) => fmt. span ,
19
- Substitution :: Escape ( _) => "%%" ,
18
+ Substitution :: Format ( fmt) => fmt. span . into ( ) ,
19
+ Substitution :: Escape ( _) => "%%" . into ( ) ,
20
20
}
21
21
}
22
+ }
22
23
24
+ impl Substitution < ' _ > {
23
25
pub ( crate ) fn position ( & self ) -> InnerSpan {
24
26
match self {
25
27
Substitution :: Format ( fmt) => fmt. position ,
@@ -627,15 +629,17 @@ pub(crate) mod shell {
627
629
Escape ( ( usize , usize ) ) ,
628
630
}
629
631
630
- impl Substitution < ' _ > {
631
- pub ( crate ) fn as_str ( & self ) -> String {
632
+ impl ToString for Substitution < ' _ > {
633
+ fn to_string ( & self ) -> String {
632
634
match self {
633
635
Substitution :: Ordinal ( n, _) => format ! ( "${n}" ) ,
634
636
Substitution :: Name ( n, _) => format ! ( "${n}" ) ,
635
637
Substitution :: Escape ( _) => "$$" . into ( ) ,
636
638
}
637
639
}
640
+ }
638
641
642
+ impl Substitution < ' _ > {
639
643
pub ( crate ) fn position ( & self ) -> InnerSpan {
640
644
let ( Self :: Ordinal ( _, pos) | Self :: Name ( _, pos) | Self :: Escape ( pos) ) = self ;
641
645
InnerSpan :: new ( pos. 0 , pos. 1 )
0 commit comments