File tree 1 file changed +12
-11
lines changed
turbopack/crates/turbo-tasks-fs/src
1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -121,16 +121,14 @@ impl Rope {
121
121
impl From < Vec < u8 > > for Rope {
122
122
fn from ( mut bytes : Vec < u8 > ) -> Self {
123
123
bytes. shrink_to_fit ( ) ;
124
- let bytes: Bytes = bytes. into ( ) ;
125
- // We can't have an InnerRope which contains an empty Local section.
126
- if bytes. is_empty ( ) {
127
- Default :: default ( )
128
- } else {
129
- Rope {
130
- length : bytes. len ( ) ,
131
- data : InnerRope ( Arc :: from ( [ Local ( bytes) ] ) ) ,
132
- }
133
- }
124
+ Rope :: from ( Bytes :: from ( bytes) )
125
+ }
126
+ }
127
+
128
+ impl From < String > for Rope {
129
+ fn from ( mut bytes : String ) -> Self {
130
+ bytes. shrink_to_fit ( ) ;
131
+ Rope :: from ( Bytes :: from ( bytes) )
134
132
}
135
133
}
136
134
@@ -325,7 +323,10 @@ impl Uncommitted {
325
323
match mem:: take ( self ) {
326
324
Self :: None => None ,
327
325
Self :: Static ( s) => Some ( s. into ( ) ) ,
328
- Self :: Owned ( v) => Some ( v. into ( ) ) ,
326
+ Self :: Owned ( mut v) => {
327
+ v. shrink_to_fit ( ) ;
328
+ Some ( v. into ( ) )
329
+ }
329
330
}
330
331
}
331
332
}
You can’t perform that action at this time.
0 commit comments