Skip to content

Commit d6fc044

Browse files
committed
codegen: don't generate extra use statements for non-enums.
There's just no advantage in doing so.
1 parent 15630c6 commit d6fc044

File tree

6 files changed

+6
-6
lines changed

6 files changed

+6
-6
lines changed

src/codegen/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ impl CodeGenerator for Type {
543543
let simple_enum_path = match inner_rust_type.node {
544544
ast::TyKind::Path(None, ref p) => {
545545
if applicable_template_args.is_empty() &&
546-
!inner_item.expect_type().canonical_type(ctx).is_builtin_or_named() &&
546+
inner_item.expect_type().canonical_type(ctx).is_enum() &&
547547
p.segments.iter().all(|p| p.parameters.is_none()) {
548548
Some(p.clone())
549549
} else {

tests/expectations/tests/bitfield_method_mangling.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ impl _bindgen_ty_1 {
4646
((val as u32 as u32) << 24u32) & (4278190080usize as u32);
4747
}
4848
}
49-
pub use self::_bindgen_ty_1 as mach_msg_type_descriptor_t;
49+
pub type mach_msg_type_descriptor_t = _bindgen_ty_1;

tests/expectations/tests/inherit_typedef.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fn bindgen_test_layout_Foo() {
1717
impl Clone for Foo {
1818
fn clone(&self) -> Self { *self }
1919
}
20-
pub use self::Foo as TypedefedFoo;
20+
pub type TypedefedFoo = Foo;
2121
#[repr(C)]
2222
#[derive(Debug, Copy)]
2323
pub struct Bar {

tests/expectations/tests/reparented_replacement.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ pub mod root {
2525
fn clone(&self) -> Self { *self }
2626
}
2727
}
28-
pub use self::super::root::foo::Bar as ReferencesBar;
28+
pub type ReferencesBar = root::foo::Bar;
2929
}

tests/expectations/tests/union_fields.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ fn bindgen_test_layout__bindgen_ty_1() {
4444
impl Clone for _bindgen_ty_1 {
4545
fn clone(&self) -> Self { *self }
4646
}
47-
pub use self::_bindgen_ty_1 as nsStyleUnion;
47+
pub type nsStyleUnion = _bindgen_ty_1;

tests/expectations/tests/unknown_attr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ pub struct _bindgen_ty_1 {
1313
impl Clone for _bindgen_ty_1 {
1414
fn clone(&self) -> Self { *self }
1515
}
16-
pub use self::_bindgen_ty_1 as max_align_t;
16+
pub type max_align_t = _bindgen_ty_1;

0 commit comments

Comments
 (0)