File tree 2 files changed +10
-15
lines changed
2 files changed +10
-15
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ use peeking_take_while::PeekableExt;
17
17
use std:: cmp;
18
18
use std:: io;
19
19
use std:: mem;
20
+ use std:: collections:: HashMap ;
20
21
21
22
/// The kind of compound type.
22
23
#[ derive( Debug , Copy , Clone , PartialEq ) ]
@@ -344,11 +345,6 @@ impl Bitfield {
344
345
self . data . bitfield ( ) . unwrap ( )
345
346
}
346
347
347
- /// Get the name of this bitfield.
348
- fn name ( & self ) -> Option < & str > {
349
- self . data . name ( )
350
- }
351
-
352
348
/// Name of the generated Rust getter for this bitfield.
353
349
///
354
350
/// Panics if called before assigning bitfield accessor names or if
@@ -703,8 +699,6 @@ impl CompFields {
703
699
}
704
700
705
701
fn deanonymize_fields ( & mut self , ctx : & BindgenContext , methods : & [ Method ] ) {
706
- use std:: collections:: HashMap ;
707
-
708
702
let fields = match * self {
709
703
CompFields :: AfterComputingBitfieldUnits ( ref mut fields) => fields,
710
704
CompFields :: BeforeComputingBitfieldUnits ( _) => {
Original file line number Diff line number Diff line change @@ -975,17 +975,18 @@ impl BindgenContext {
975
975
///
976
976
/// Panics if attempt to resolve given `ItemId` inside the given
977
977
/// closure is made.
978
- fn with_loaned_item < F : FnOnce ( & BindgenContext , & mut Item ) > (
979
- & mut self ,
980
- item_id : ItemId ,
981
- f : F ,
982
- ) {
983
- let mut item = self . items . remove ( & item_id) . unwrap ( ) ;
978
+ fn with_loaned_item < F , T > ( & mut self , id : ItemId , f : F ) -> T
979
+ where
980
+ F : ( FnOnce ( & BindgenContext , & mut Item ) -> T )
981
+ {
982
+ let mut item = self . items . remove ( & id) . unwrap ( ) ;
984
983
985
- f ( self , & mut item) ;
984
+ let result = f ( self , & mut item) ;
986
985
987
- let existing = self . items . insert ( item_id , item) ;
986
+ let existing = self . items . insert ( id , item) ;
988
987
assert ! ( existing. is_none( ) ) ;
988
+
989
+ result
989
990
}
990
991
991
992
/// Compute the bitfield allocation units for all `TypeKind::Comp` items we
You can’t perform that action at this time.
0 commit comments