@@ -603,7 +603,7 @@ impl TopologyDescription {
603603 return Ok ( ( ) ) ;
604604 }
605605
606- self . add_new_servers ( server_description. known_hosts ( ) ?) ? ;
606+ self . add_new_servers ( server_description. known_hosts ( ) ?) ;
607607
608608 if server_description. invalid_me ( ) ? {
609609 self . servers . remove ( & server_description. address ) ;
@@ -697,11 +697,11 @@ impl TopologyDescription {
697697 }
698698 }
699699
700- self . add_new_servers ( server_description. known_hosts ( ) ? ) ?;
701- let known_hosts : HashSet < _ > = server_description . known_hosts ( ) ? . collect ( ) ;
700+ let known_hosts = server_description. known_hosts ( ) ?;
701+ self . add_new_servers ( known_hosts . clone ( ) ) ;
702702
703703 for address in addresses {
704- if !known_hosts. contains ( & address. to_string ( ) ) {
704+ if !known_hosts. contains ( & address) {
705705 self . servers . remove ( & address) ;
706706 }
707707 }
@@ -728,20 +728,9 @@ impl TopologyDescription {
728728 }
729729
730730 /// Create a new ServerDescription for each address and add it to the topology.
731- fn add_new_servers < ' a > ( & mut self , servers : impl Iterator < Item = & ' a String > ) -> Result < ( ) > {
732- let servers: Result < Vec < _ > > = servers. map ( ServerAddress :: parse) . collect ( ) ;
733-
734- self . add_new_servers_from_addresses ( servers?. iter ( ) ) ;
735- Ok ( ( ) )
736- }
737-
738- /// Create a new ServerDescription for each address and add it to the topology.
739- fn add_new_servers_from_addresses < ' a > (
740- & mut self ,
741- servers : impl Iterator < Item = & ' a ServerAddress > ,
742- ) {
731+ fn add_new_servers ( & mut self , servers : Vec < ServerAddress > ) {
743732 for server in servers {
744- if !self . servers . contains_key ( server) {
733+ if !self . servers . contains_key ( & server) {
745734 self . servers
746735 . insert ( server. clone ( ) , ServerDescription :: new ( server. clone ( ) ) ) ;
747736 }
0 commit comments