Skip to content

Commit 953fc76

Browse files
dingxiangfei2009emilio
authored andcommitted
Simplify some pattern matching
This small patch is to pulled away off another patch. With this we are one `clone` less and the pattern getting matched against is more obvious. Signed-off-by: Xiangfei Ding <[email protected]>
1 parent ccd5637 commit 953fc76

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

bindgen/ir/context.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2055,10 +2055,12 @@ If you encounter an error missing from this list, please file an issue or a PR!"
20552055
let mut header_names_to_compile = Vec::new();
20562056
let mut header_paths = Vec::new();
20572057
let mut header_includes = Vec::new();
2058-
let single_header = self.options().input_headers.last().cloned()?;
2059-
for input_header in &self.options.input_headers
2060-
[..self.options.input_headers.len() - 1]
2061-
{
2058+
let [input_headers @ .., single_header] =
2059+
&self.options().input_headers[..]
2060+
else {
2061+
return None;
2062+
};
2063+
for input_header in input_headers {
20622064
let path = Path::new(input_header.as_ref());
20632065
if let Some(header_path) = path.parent() {
20642066
if header_path == Path::new("") {
@@ -2095,7 +2097,7 @@ If you encounter an error missing from this list, please file an issue or a PR!"
20952097
}
20962098
let mut tu = clang::TranslationUnit::parse(
20972099
&index,
2098-
&single_header,
2100+
single_header,
20992101
&c_args,
21002102
&[],
21012103
clang_sys::CXTranslationUnit_ForSerialization,

0 commit comments

Comments
 (0)