Skip to content

Commit

Permalink
Formatting tweaks.
Browse files Browse the repository at this point in the history
  • Loading branch information
adetaylor committed Feb 19, 2025
1 parent 4c9a018 commit 67b12a7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ impl ParseCallbacks for ItemDiscovery {
}
}

fn test_item_discovery_callback(header: &str, expected: HashMap<DiscoveredItemId, DiscoveredItem>) {
fn test_item_discovery_callback(
header: &str,
expected: HashMap<DiscoveredItemId, DiscoveredItem>,
) {
let discovery = ItemDiscovery::default();
let info = Rc::clone(&discovery.0);

Expand All @@ -31,7 +34,6 @@ fn test_item_discovery_callback(header: &str, expected: HashMap<DiscoveredItemId
.generate()
.expect("TODO: panic message");


compare_item_caches(&info.borrow(), &expected);
}

Expand Down Expand Up @@ -104,7 +106,6 @@ fn test_item_discovery_callback_c() {
"/tests/parse_callbacks/item_discovery_callback/header_item_discovery.h", expected);
}


#[test]
fn test_item_discovery_callback_cpp() {
let expected = ItemCache::from([
Expand Down
3 changes: 1 addition & 2 deletions bindgen/callbacks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,7 @@ pub enum DiscoveredItem {

/// Type to which this method belongs.
parent: DiscoveredItemId,
}
// modules, etc.
}, // modules, etc.
}

/// Relevant information about a type to which new derive attributes will be added using
Expand Down
20 changes: 11 additions & 9 deletions bindgen/codegen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2502,10 +2502,7 @@ impl CodeGenerator for CompInfo {
},
};

cb.new_item_found(
discovered_id,
discovered_item,
);
cb.new_item_found(discovered_id, discovered_item);
});

// The custom derives callback may return a list of derive attributes;
Expand Down Expand Up @@ -3071,10 +3068,15 @@ impl Method {

method_names.insert(name.clone());

ctx.options().for_each_callback(|cb| cb.new_item_found(id, DiscoveredItem::Method {
parent: parent_id,
final_name: name.clone(),
}));
ctx.options().for_each_callback(|cb| {
cb.new_item_found(
id,
DiscoveredItem::Method {
parent: parent_id,
final_name: name.clone(),
},
)
});

let mut function_name = function_item.canonical_name(ctx);
if times_seen > 0 {
Expand Down Expand Up @@ -4667,7 +4669,7 @@ impl CodeGenerator for Function {
id,
DiscoveredItem::Function {
final_name: canonical_name.to_string(),
}
},
);
});

Expand Down

0 comments on commit 67b12a7

Please sign in to comment.