1- use crate :: errors:: UserError ;
1+ use crate :: errors:: { AssignmentError , UserError } ;
22use crate :: team_data:: TeamClient ;
33use anyhow:: Context ;
44use async_trait:: async_trait;
@@ -547,30 +547,13 @@ where
547547 }
548548}
549549
550- #[ derive( Debug ) ]
551- pub enum AssignmentError {
552- InvalidAssignee ,
553- Http ( anyhow:: Error ) ,
554- }
555-
556550#[ derive( Debug ) ]
557551pub enum Selection < ' a , T : ?Sized > {
558552 All ,
559553 One ( & ' a T ) ,
560554 Except ( & ' a T ) ,
561555}
562556
563- impl fmt:: Display for AssignmentError {
564- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
565- match self {
566- AssignmentError :: InvalidAssignee => write ! ( f, "invalid assignee" ) ,
567- AssignmentError :: Http ( e) => write ! ( f, "cannot assign: {e}" ) ,
568- }
569- }
570- }
571-
572- impl std:: error:: Error for AssignmentError { }
573-
574557#[ derive( Debug , Clone , PartialEq , Eq ) ]
575558pub struct IssueRepository {
576559 pub organization : String ,
@@ -916,12 +899,14 @@ impl Issue {
916899 struct AssigneeReq < ' a > {
917900 assignees : & ' a [ & ' a str ] ,
918901 }
902+
919903 client
920904 . send_req ( client. delete ( & url) . json ( & AssigneeReq {
921905 assignees : & assignees[ ..] ,
922906 } ) )
923907 . await
924- . map_err ( AssignmentError :: Http ) ?;
908+ . map_err ( AssignmentError :: Other ) ?;
909+
925910 Ok ( ( ) )
926911 }
927912
@@ -945,7 +930,8 @@ impl Issue {
945930 let result: Issue = client
946931 . json ( client. post ( & url) . json ( & AssigneeReq { assignees : & [ user] } ) )
947932 . await
948- . map_err ( AssignmentError :: Http ) ?;
933+ . map_err ( AssignmentError :: Other ) ?;
934+
949935 // Invalid assignees are silently ignored. We can just check if the user is now
950936 // contained in the assignees list.
951937 let success = result
0 commit comments