File tree Expand file tree Collapse file tree 1 file changed +2
-8
lines changed Expand file tree Collapse file tree 1 file changed +2
-8
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import (
21
21
"errors"
22
22
"fmt"
23
23
"reflect"
24
+ "slices"
24
25
"sync"
25
26
"time"
26
27
)
@@ -122,7 +123,7 @@ func (mux *TypeMux) del(s *TypeMuxSubscription) {
122
123
if len (subs ) == 1 {
123
124
delete (mux .subm , typ )
124
125
} else {
125
- mux .subm [typ ] = posdelete ( subs , pos )
126
+ mux .subm [typ ] = slices . Delete ( slices . Clone ( subs ) , pos , pos + 1 )
126
127
}
127
128
}
128
129
}
@@ -137,13 +138,6 @@ func find(slice []*TypeMuxSubscription, item *TypeMuxSubscription) int {
137
138
return - 1
138
139
}
139
140
140
- func posdelete (slice []* TypeMuxSubscription , pos int ) []* TypeMuxSubscription {
141
- news := make ([]* TypeMuxSubscription , len (slice )- 1 )
142
- copy (news [:pos ], slice [:pos ])
143
- copy (news [pos :], slice [pos + 1 :])
144
- return news
145
- }
146
-
147
141
// TypeMuxSubscription is a subscription established through TypeMux.
148
142
type TypeMuxSubscription struct {
149
143
mux * TypeMux
You can’t perform that action at this time.
0 commit comments