Skip to content

Commit 8a33157

Browse files
committed
Refactor header line condition to avoid None unwrap
If the test source file doesn't contain any headers, or that are not added till now then the header value will be None and becomes panic Signed-off-by: Muhammad Mahad <[email protected]>
1 parent e561a01 commit 8a33157

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/header.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ pub fn parse_additional_options(code: &str) -> Vec<HeaderLine> {
2020
continue;
2121
}
2222
if is_header_line(line) {
23-
headers.push(add_additional_options(line, line_number).unwrap());
23+
if let Some(header_info) = add_additional_options(line, line_number) {
24+
headers.push(header_info);
25+
}
2426
}
2527
}
2628
headers

0 commit comments

Comments
 (0)