Skip to content

Commit e97b701

Browse files
author
l
committed
expect instead of unwrap
1 parent 2285175 commit e97b701

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/bin/pr-metadata-validator.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,13 @@ async fn check_pr_file_changes(
290290
Err(_) => return Ok(Some(ValidationResult::CouldNotMatch)), // Failed to find the right task
291291
};
292292
let task_issue_body = task_issue.body.unwrap_or_default();
293-
let directory_description = Regex::new("CHANGE_DIR=(.+)\\n").unwrap();
293+
let directory_description =
294+
Regex::new("CHANGE_DIR=(.+)\\n").expect("Known good regex failed to compile");
294295
let directory_description_regex = match directory_description.captures(&task_issue_body) {
295-
Some(capts) => capts.get(1).unwrap().as_str(), // Only allows a single directory for now
296+
Some(capts) => capts
297+
.get(1)
298+
.expect("Regex capture failed to return string match")
299+
.as_str(), // Only allows a single directory for now
296300
None => return Ok(None), // There is no match defined for this task, don't do any more checks
297301
};
298302
let directory_matcher = Regex::new(directory_description_regex)

0 commit comments

Comments
 (0)