@@ -1232,7 +1232,7 @@ impl<'a> Connection<'a> {
1232
1232
. iter ( )
1233
1233
. map ( |( node, count) | ( node. as_str ( ) , * count) )
1234
1234
. chain ( missing)
1235
- . min_by ( |( _, a ) , ( _ , b ) | a . cmp ( b ) )
1235
+ . min_by_key ( |( _, count ) | * count )
1236
1236
. map ( |( node, _) | NodeId :: new ( node) . map_err ( |( ) | node) )
1237
1237
. transpose ( )
1238
1238
// This can't really happen since we filtered by valid NodeId's
@@ -1260,6 +1260,8 @@ impl<'a> Connection<'a> {
1260
1260
. order_by ( sql :: < i64 > ( "count(*)" ) )
1261
1261
. load :: < ( String , i64 ) > ( self . conn . as_ref ( ) ) ?;
1262
1262
1263
+ // Any shards that have no deployments in them will not be in
1264
+ // 'used'; add them in with a count of 0
1263
1265
let missing = shards
1264
1266
. into_iter ( )
1265
1267
. filter ( |shard| !used. iter ( ) . any ( |( s, _) | s == shard. as_str ( ) ) )
@@ -1268,7 +1270,7 @@ impl<'a> Connection<'a> {
1268
1270
used. iter ( )
1269
1271
. map ( |( shard, count) | ( shard. as_str ( ) , * count) )
1270
1272
. chain ( missing)
1271
- . min_by ( |( _, a ) , ( _ , b ) | a . cmp ( b ) )
1273
+ . min_by_key ( |( _, count ) | * count )
1272
1274
. map ( |( shard, _) | Shard :: new ( shard. to_string ( ) ) )
1273
1275
. transpose ( )
1274
1276
// This can't really happen since we filtered by valid shards
0 commit comments