Skip to content

Commit

Permalink
Clippy formatting fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
adetaylor committed Feb 20, 2025
1 parent f607994 commit 743c469
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
29 changes: 13 additions & 16 deletions bindgen-tests/tests/parse_callbacks/item_discovery_callback/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,18 +227,15 @@ fn compare_item_caches(
// if the header file or the bindgen logic is altered
// - aliases have a DiscoveredItemId that we can't directly compare for the same instability reasons
for expected_item in expected.values() {
let found =
generated
.iter()
.find(|(_generated_id, generated_item)| {
compare_item_info(
expected_item,
generated_item,
expected,
generated,
expected_filename,
)
});
let found = generated.iter().find(|(_generated_id, generated_item)| {
compare_item_info(
expected_item,
generated_item,
expected,
generated,
expected_filename,
)
});

assert!(
found.is_some(),
Expand All @@ -254,8 +251,8 @@ fn compare_item_info(
generated: &ItemCache,
expected_filename: &str,
) -> bool {
if std::mem::discriminant(&expected_item.item)
!= std::mem::discriminant(&generated_item.0)
if std::mem::discriminant(&expected_item.item) !=
std::mem::discriminant(&generated_item.0)
{
return false;
}
Expand Down Expand Up @@ -288,8 +285,8 @@ fn compare_item_info(
if is_a_match {
// Compare source location
assert!(
generated_item.1.is_some()
== expected_item.source_location.is_some(),
generated_item.1.is_some() ==
expected_item.source_location.is_some(),
"No source location provided when one was expected"
);
if let Some(generated_location) = generated_item.1.as_ref() {
Expand Down
8 changes: 7 additions & 1 deletion bindgen/callbacks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,13 @@ pub trait ParseCallbacks: fmt::Debug {
}

/// This will get called everytime an item (currently struct, union, and alias) is found with some information about it
fn new_item_found(&self, _id: DiscoveredItemId, _item: DiscoveredItem, _source_location: Option<&SourceLocation>) {}
fn new_item_found(
&self,
_id: DiscoveredItemId,
_item: DiscoveredItem,
_source_location: Option<&SourceLocation>,
) {
}

// TODO add callback for ResolvedTypeRef
}
Expand Down

0 comments on commit 743c469

Please sign in to comment.