File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -305,14 +305,29 @@ impl TextRange {
305
305
impl Index < TextRange > for str {
306
306
type Output = str ;
307
307
#[ inline]
308
- fn index ( & self , index : TextRange ) -> & Self :: Output {
308
+ fn index ( & self , index : TextRange ) -> & str {
309
+ & self [ Range :: < usize > :: from ( index) ]
310
+ }
311
+ }
312
+
313
+ impl Index < TextRange > for String {
314
+ type Output = str ;
315
+ #[ inline]
316
+ fn index ( & self , index : TextRange ) -> & str {
309
317
& self [ Range :: < usize > :: from ( index) ]
310
318
}
311
319
}
312
320
313
321
impl IndexMut < TextRange > for str {
314
322
#[ inline]
315
- fn index_mut ( & mut self , index : TextRange ) -> & mut Self :: Output {
323
+ fn index_mut ( & mut self , index : TextRange ) -> & mut str {
324
+ & mut self [ Range :: < usize > :: from ( index) ]
325
+ }
326
+ }
327
+
328
+ impl IndexMut < TextRange > for String {
329
+ #[ inline]
330
+ fn index_mut ( & mut self , index : TextRange ) -> & mut str {
316
331
& mut self [ Range :: < usize > :: from ( index) ]
317
332
}
318
333
}
You can’t perform that action at this time.
0 commit comments