Skip to content

Commit 727b8a1

Browse files
author
l
committed
simplify reading issue body
1 parent 2a94e71 commit 727b8a1

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

src/bin/pr-metadata-validator.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ async fn main() {
8585
&format!("{}{}", BAD_TITLE_COMMENT_PREFIX, reason)
8686
}
8787
ValidationResult::UnknownRegion => UNKNOWN_REGION_COMMENT,
88-
ValidationResult::WrongFiles { expected_files_pattern } => &format!("{}`{}`", WRONG_FILES, expected_files_pattern),
88+
ValidationResult::WrongFiles {
89+
expected_files_pattern,
90+
} => &format!("{}`{}`", WRONG_FILES, expected_files_pattern),
8991
ValidationResult::NoFiles => NO_FILES,
9092
};
9193

@@ -287,10 +289,7 @@ async fn check_pr_file_changes(
287289
Ok(iss) => iss,
288290
Err(_) => return Ok(Some(ValidationResult::CouldNotMatch)), // Failed to find the right task
289291
};
290-
let task_issue_body = match task_issue.body {
291-
Some(body) => body,
292-
None => return Ok(None), // Task is empty, nothing left to check
293-
};
292+
let task_issue_body = task_issue.body.unwrap_or_default();
294293
let directory_description = Regex::new("CHANGE_DIR=(.+)\\n").unwrap();
295294
let directory_description_regex = match directory_description.captures(&task_issue_body) {
296295
Some(capts) => capts.get(1).unwrap().as_str(), // Only allows a single directory for now

0 commit comments

Comments
 (0)