@@ -250,19 +250,13 @@ async fn validate_pr(
250250 // This should never error, as a PR by this point in code must have been matched
251251 // with an assignment, and PR assignments must have an associated issue descriptor
252252
253- match check_pr_file_changes (
253+ check_pr_file_changes (
254254 octocrab,
255255 github_org_name,
256256 module_name,
257257 pr_number,
258258 pr_assignment_descriptor_id,
259- )
260- . await
261- {
262- Ok ( Some ( problem) ) => Ok ( problem) ,
263- Ok ( None ) => Ok ( ValidationResult :: Ok ) ,
264- Err ( err) => Err ( err) ,
265- }
259+ ) . await
266260}
267261
268262// Check the changed files in a pull request match what is expected for that sprint task
@@ -272,22 +266,22 @@ async fn check_pr_file_changes(
272266 module_name : & str ,
273267 pr_number : u64 ,
274268 task_issue_number : u64 ,
275- ) -> Result < Option < ValidationResult > , Error > {
269+ ) -> Result < ValidationResult , Error > {
276270 // Get the Sprint Task's description of expected changes
277271 let Ok ( task_issue) = octocrab
278272 . issues ( org_name, module_name)
279273 . get ( task_issue_number)
280274 . await
281275 else {
282- return Ok ( Some ( ValidationResult :: CouldNotMatch ) ) ; // Failed to find the right task
276+ return Ok ( ValidationResult :: CouldNotMatch ) ; // Failed to find the right task
283277 } ;
284278
285279 let task_issue_body = task_issue. body . unwrap_or_default ( ) ;
286280
287281 let directory_description =
288282 Regex :: new ( "CHANGE_DIR=(.+)\\ n" ) . expect ( "Known good regex failed to compile" ) ;
289283 let Some ( directory_regex_captures) = directory_description. captures ( & task_issue_body) else {
290- return Ok ( None ) ; // There is no match defined for this task, don't do any more checks
284+ return Ok ( ValidationResult :: Ok ) ; // There is no match defined for this task, don't do any more checks
291285 } ;
292286 let directory_description_regex = directory_regex_captures
293287 . get ( 1 )
@@ -318,19 +312,19 @@ async fn check_pr_file_changes(
318312 } )
319313 . await ?;
320314 if pr_files. is_empty ( ) {
321- return Ok ( Some ( ValidationResult :: NoFiles ) ) ; // no files committed
315+ return Ok ( ValidationResult :: NoFiles ) ; // no files committed
322316 }
323317
324318 // check each file and error if one is in unexpected place
325319 for pr_file in pr_files {
326320 if !directory_matcher. is_match ( & pr_file. filename ) {
327- return Ok ( Some ( ValidationResult :: WrongFiles {
321+ return Ok ( ValidationResult :: WrongFiles {
328322 expected_files_pattern : directory_description_regex. to_string ( ) ,
329- } ) ) ;
323+ } ) ;
330324 }
331325 }
332326
333- Ok ( None )
327+ Ok ( ValidationResult :: Ok )
334328}
335329
336330struct KnownRegions ( BTreeMap < & ' static str , Vec < & ' static str > > ) ;
0 commit comments