File tree 3 files changed +12
-17
lines changed 3 files changed +12
-17
lines changed Original file line number Diff line number Diff line change @@ -1462,7 +1462,7 @@ impl ToRustTy for Type {
1462
1462
IntKind :: U32 => aster:: ty:: TyBuilder :: new ( ) . u32 ( ) ,
1463
1463
IntKind :: I64 => aster:: ty:: TyBuilder :: new ( ) . i64 ( ) ,
1464
1464
IntKind :: U64 => aster:: ty:: TyBuilder :: new ( ) . u64 ( ) ,
1465
- IntKind :: Custom ( name, _signed ) => {
1465
+ IntKind :: Custom { name, .. } => {
1466
1466
let ident = ctx. rust_ident_raw ( name) ;
1467
1467
quote_ty ! ( ctx. ext_cx( ) , $ident)
1468
1468
}
Original file line number Diff line number Diff line change @@ -68,9 +68,12 @@ pub enum IntKind {
68
68
69
69
/// A custom integer type, used to allow custom macro types depending on
70
70
/// range.
71
- ///
72
- /// The boolean means a whether this is a signed integer type or not.
73
- Custom ( & ' static str , bool ) ,
71
+ Custom {
72
+ /// The name of the type, which would be used without modification.
73
+ name : & ' static str ,
74
+ /// Whether the type is signed or not.
75
+ is_signed : bool ,
76
+ } ,
74
77
}
75
78
76
79
impl IntKind {
@@ -84,7 +87,7 @@ impl IntKind {
84
87
Char | Short | Int | Long | LongLong | I8 | I16 | I32 | I64 |
85
88
I128 => true ,
86
89
87
- Custom ( _ , signed ) => signed ,
90
+ Custom { is_signed , .. } => is_signed ,
88
91
}
89
92
}
90
93
}
Original file line number Diff line number Diff line change @@ -111,16 +111,9 @@ impl ClangSubItemParser for Var {
111
111
EvalResult :: Invalid => return Err ( ParseError :: Continue ) ,
112
112
113
113
EvalResult :: Int ( Wrapping ( value) ) => {
114
- let kind = match ctx. options ( ) . type_chooser {
115
- Some ( ref chooser) => {
116
- chooser. int_macro ( & name, value)
117
- }
118
- None => None ,
119
- } ;
120
-
121
- let kind = match kind {
122
- Some ( kind) => kind,
123
- None => {
114
+ let kind = ctx. options ( ) . type_chooser . as_ref ( )
115
+ . and_then ( |c| c. int_macro ( & name, value) )
116
+ . unwrap_or_else ( || {
124
117
if value < 0 {
125
118
if value < i32:: min_value ( ) as i64 {
126
119
IntKind :: LongLong
@@ -132,8 +125,7 @@ impl ClangSubItemParser for Var {
132
125
} else {
133
126
IntKind :: UInt
134
127
}
135
- }
136
- } ;
128
+ } ) ;
137
129
138
130
( kind, value)
139
131
}
You can’t perform that action at this time.
0 commit comments