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 {
305305impl Index < TextRange > for str {
306306 type Output = str ;
307307 #[ 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 {
309317 & self [ Range :: < usize > :: from ( index) ]
310318 }
311319}
312320
313321impl IndexMut < TextRange > for str {
314322 #[ 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 {
316331 & mut self [ Range :: < usize > :: from ( index) ]
317332 }
318333}
You can’t perform that action at this time.
0 commit comments