File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -62,9 +62,9 @@ impl TeammateManager {
6262 . ok_or_else ( || TeamError :: AgentNotFound ( slot_id. to_owned ( ) ) ) ?;
6363
6464 // Check all other agents for name collision (exclude self).
65- let conflict = slots. iter ( ) . any ( | ( id , s ) | {
66- id != slot_id && super :: normalize_name ( & s . agent . name ) == normalized
67- } ) ;
65+ let conflict = slots
66+ . iter ( )
67+ . any ( | ( id , s ) | id != slot_id && super :: normalize_name ( & s . agent . name ) == normalized ) ;
6868 if conflict {
6969 return Err ( TeamError :: DuplicateAgentName ( new_name. to_owned ( ) ) ) ;
7070 }
Original file line number Diff line number Diff line change @@ -481,9 +481,10 @@ impl TeamSessionService {
481481 }
482482
483483 // Uniqueness check against all other agents in the team.
484- let has_conflict = team. agents . iter ( ) . any ( |a| {
485- a. slot_id != slot_id && crate :: scheduler:: normalize_name ( & a. name ) == normalized
486- } ) ;
484+ let has_conflict = team
485+ . agents
486+ . iter ( )
487+ . any ( |a| a. slot_id != slot_id && crate :: scheduler:: normalize_name ( & a. name ) == normalized) ;
487488 if has_conflict {
488489 return Err ( TeamError :: DuplicateAgentName ( name. to_owned ( ) ) ) ;
489490 }
Original file line number Diff line number Diff line change @@ -1371,12 +1371,7 @@ mod tests {
13711371 async fn rename_agent_rejects_duplicate_in_session ( ) {
13721372 let session = start_session ( ) . await ;
13731373 let agents = session. scheduler . list_agents ( ) . await ;
1374- let lead_name = agents
1375- . iter ( )
1376- . find ( |a| a. slot_id == "lead-1" )
1377- . unwrap ( )
1378- . name
1379- . clone ( ) ;
1374+ let lead_name = agents. iter ( ) . find ( |a| a. slot_id == "lead-1" ) . unwrap ( ) . name . clone ( ) ;
13801375
13811376 // Rename worker-1 to the lead's name — should collide.
13821377 let result = session. rename_agent ( "worker-1" , & lead_name) . await ;
You can’t perform that action at this time.
0 commit comments