Skip to content

Commit 67b12a7

Browse files
committed
Formatting tweaks.
1 parent 4c9a018 commit 67b12a7

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

bindgen-tests/tests/parse_callbacks/item_discovery_callback/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ impl ParseCallbacks for ItemDiscovery {
1818
}
1919
}
2020

21-
fn test_item_discovery_callback(header: &str, expected: HashMap<DiscoveredItemId, DiscoveredItem>) {
21+
fn test_item_discovery_callback(
22+
header: &str,
23+
expected: HashMap<DiscoveredItemId, DiscoveredItem>,
24+
) {
2225
let discovery = ItemDiscovery::default();
2326
let info = Rc::clone(&discovery.0);
2427

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

34-
3537
compare_item_caches(&info.borrow(), &expected);
3638
}
3739

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

107-
108109
#[test]
109110
fn test_item_discovery_callback_cpp() {
110111
let expected = ItemCache::from([

bindgen/callbacks.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,7 @@ pub enum DiscoveredItem {
238238

239239
/// Type to which this method belongs.
240240
parent: DiscoveredItemId,
241-
}
242-
// modules, etc.
241+
}, // modules, etc.
243242
}
244243

245244
/// Relevant information about a type to which new derive attributes will be added using

bindgen/codegen/mod.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2502,10 +2502,7 @@ impl CodeGenerator for CompInfo {
25022502
},
25032503
};
25042504

2505-
cb.new_item_found(
2506-
discovered_id,
2507-
discovered_item,
2508-
);
2505+
cb.new_item_found(discovered_id, discovered_item);
25092506
});
25102507

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

30723069
method_names.insert(name.clone());
30733070

3074-
ctx.options().for_each_callback(|cb| cb.new_item_found(id, DiscoveredItem::Method {
3075-
parent: parent_id,
3076-
final_name: name.clone(),
3077-
}));
3071+
ctx.options().for_each_callback(|cb| {
3072+
cb.new_item_found(
3073+
id,
3074+
DiscoveredItem::Method {
3075+
parent: parent_id,
3076+
final_name: name.clone(),
3077+
},
3078+
)
3079+
});
30783080

30793081
let mut function_name = function_item.canonical_name(ctx);
30803082
if times_seen > 0 {
@@ -4667,7 +4669,7 @@ impl CodeGenerator for Function {
46674669
id,
46684670
DiscoveredItem::Function {
46694671
final_name: canonical_name.to_string(),
4670-
}
4672+
},
46714673
);
46724674
});
46734675

0 commit comments

Comments
 (0)