@@ -823,13 +823,13 @@ pub enum BenchmarkRequestType {
823823 /// A Try commit
824824 Try {
825825 sha : String ,
826- parent_sha : Option < String > ,
826+ parent_sha : String ,
827827 pr : u32 ,
828828 } ,
829829 /// A Master commit
830830 Master {
831831 sha : String ,
832- parent_sha : Option < String > ,
832+ parent_sha : String ,
833833 pr : u32 ,
834834 } ,
835835 /// A release only has a tag
@@ -857,16 +857,8 @@ impl BenchmarkRequestType {
857857impl fmt:: Display for BenchmarkRequestType {
858858 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
859859 match self {
860- BenchmarkRequestType :: Try {
861- sha : _,
862- parent_sha : _,
863- pr : _,
864- } => write ! ( f, "try" ) ,
865- BenchmarkRequestType :: Master {
866- sha : _,
867- parent_sha : _,
868- pr : _,
869- } => write ! ( f, "master" ) ,
860+ BenchmarkRequestType :: Try { .. } => write ! ( f, "try" ) ,
861+ BenchmarkRequestType :: Master { .. } => write ! ( f, "master" ) ,
870862 BenchmarkRequestType :: Release { tag : _ } => write ! ( f, "release" ) ,
871863 }
872864 }
@@ -904,7 +896,7 @@ impl BenchmarkRequest {
904896
905897 pub fn create_try (
906898 sha : & str ,
907- parent_sha : Option < & str > ,
899+ parent_sha : & str ,
908900 pr : u32 ,
909901 created_at : DateTime < Utc > ,
910902 status : BenchmarkRequestStatus ,
@@ -915,7 +907,7 @@ impl BenchmarkRequest {
915907 commit_type : BenchmarkRequestType :: Try {
916908 pr,
917909 sha : sha. to_string ( ) ,
918- parent_sha : parent_sha. map ( |it| it . to_string ( ) ) ,
910+ parent_sha : parent_sha. to_string ( ) ,
919911 } ,
920912 created_at,
921913 completed_at : None ,
@@ -927,7 +919,7 @@ impl BenchmarkRequest {
927919
928920 pub fn create_master (
929921 sha : & str ,
930- parent_sha : Option < & str > ,
922+ parent_sha : & str ,
931923 pr : u32 ,
932924 created_at : DateTime < Utc > ,
933925 status : BenchmarkRequestStatus ,
@@ -938,7 +930,7 @@ impl BenchmarkRequest {
938930 commit_type : BenchmarkRequestType :: Master {
939931 pr,
940932 sha : sha. to_string ( ) ,
941- parent_sha : parent_sha. map ( |it| it . to_string ( ) ) ,
933+ parent_sha : parent_sha. to_string ( ) ,
942934 } ,
943935 created_at,
944936 completed_at : None ,
@@ -952,32 +944,16 @@ impl BenchmarkRequest {
952944 /// `release`
953945 pub fn tag ( & self ) -> & str {
954946 match & self . commit_type {
955- BenchmarkRequestType :: Try {
956- sha,
957- parent_sha : _,
958- pr : _,
959- }
960- | BenchmarkRequestType :: Master {
961- sha,
962- parent_sha : _,
963- pr : _,
964- } => sha,
947+ BenchmarkRequestType :: Try { sha, .. } | BenchmarkRequestType :: Master { sha, .. } => sha,
965948 BenchmarkRequestType :: Release { tag } => tag,
966949 }
967950 }
968951
969952 pub fn pr ( & self ) -> Option < & u32 > {
970953 match & self . commit_type {
971- BenchmarkRequestType :: Try {
972- sha : _,
973- parent_sha : _,
974- pr,
954+ BenchmarkRequestType :: Try { pr, .. } | BenchmarkRequestType :: Master { pr, .. } => {
955+ Some ( pr)
975956 }
976- | BenchmarkRequestType :: Master {
977- sha : _,
978- parent_sha : _,
979- pr,
980- } => Some ( pr) ,
981957 BenchmarkRequestType :: Release { tag : _ } => None ,
982958 }
983959 }
@@ -988,19 +964,8 @@ impl BenchmarkRequest {
988964
989965 pub fn parent_sha ( & self ) -> Option < & str > {
990966 match & self . commit_type {
991- BenchmarkRequestType :: Try {
992- sha : _,
993- parent_sha,
994- pr : _,
995- }
996- | BenchmarkRequestType :: Master {
997- sha : _,
998- parent_sha,
999- pr : _,
1000- } => match parent_sha {
1001- Some ( parent_sha) => Some ( parent_sha) ,
1002- None => None ,
1003- } ,
967+ BenchmarkRequestType :: Try { parent_sha, .. }
968+ | BenchmarkRequestType :: Master { parent_sha, .. } => Some ( parent_sha) ,
1004969 BenchmarkRequestType :: Release { tag : _ } => None ,
1005970 }
1006971 }
0 commit comments