Skip to content

Commit 14ee85b

Browse files
jschweemilio
authored andcommitted
process_comment: Use last defined callback
Instead of using the last registered callback, iterate through all callbacks and use the last one that was actually implemented and returned `Some()`. This is essentially when users register more than one parse callback - the process_comment may not be the last.
1 parent b7c7964 commit 14ee85b

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

bindgen/lib.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -582,9 +582,7 @@ impl BindgenOptions {
582582

583583
fn process_comment(&self, comment: &str) -> String {
584584
let comment = comment::preprocess(comment);
585-
self.parse_callbacks
586-
.last()
587-
.and_then(|cb| cb.process_comment(&comment))
585+
self.last_callback(|cb| cb.process_comment(&comment))
588586
.unwrap_or(comment)
589587
}
590588
}

0 commit comments

Comments
 (0)