File tree 1 file changed +10
-6
lines changed
1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -155,16 +155,20 @@ impl NameServiceProxy {
155
155
// If we're writing, try the current known active and then loop
156
156
// through the rest if that fails
157
157
let first = current_active;
158
- let rest = ( 0 ..self . proxy_connections . len ( ) )
159
- . filter ( |i| * i != first)
160
- . collect :: < Vec < usize > > ( ) ;
161
- [ vec ! [ first] , rest] . concat ( )
158
+ let rest = ( 0 ..self . proxy_connections . len ( ) ) . filter ( |i| * i != first) ;
159
+ [ first] . into_iter ( ) . chain ( rest) . collect :: < Vec < _ > > ( )
162
160
} else {
163
161
// If we're reading, try all known observers, then the active, then
164
162
// any remaining
165
- let mut first = self . current_observers . lock ( ) . unwrap ( ) . clone ( ) ;
163
+ let mut first = self
164
+ . current_observers
165
+ . lock ( )
166
+ . unwrap ( )
167
+ . iter ( )
168
+ . copied ( )
169
+ . collect :: < Vec < _ > > ( ) ;
166
170
if !first. contains ( & current_active) {
167
- first. insert ( current_active) ;
171
+ first. push ( current_active) ;
168
172
}
169
173
let rest = ( 0 ..self . proxy_connections . len ( ) ) . filter ( |i| !first. contains ( i) ) ;
170
174
first. iter ( ) . copied ( ) . chain ( rest) . collect ( )
You can’t perform that action at this time.
0 commit comments