File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -152,12 +152,13 @@ impl InterpolationCompiler {
152152 escaped : false ,
153153 } ;
154154
155- // for each character, check if the character is a
155+ // for each character, check if the character exists, then
156+ // feed it into the compiler
156157 while let Some ( character) = compiler. chars . get ( compiler. index ) . copied ( ) {
157158 compiler. handle_char ( character) ?;
158159 }
159160
160- compiler. parts . shrink_to_fit ( ) ;
161+ compiler. shrink ( ) ;
161162
162163 Ok ( Interpolation {
163164 parts : compiler. parts ,
@@ -215,6 +216,17 @@ impl InterpolationCompiler {
215216 }
216217 Ok ( identifier)
217218 }
219+
220+ fn shrink ( & mut self ) {
221+ self . parts . shrink_to_fit ( ) ;
222+
223+ for ( a, b) in & mut self . parts {
224+ a. shrink_to_fit ( ) ;
225+ b. shrink_to_fit ( ) ;
226+ }
227+
228+ self . next . shrink_to_fit ( ) ;
229+ }
218230}
219231
220232/// Error returned in the parsing stage.
You can’t perform that action at this time.
0 commit comments