@@ -51,9 +51,9 @@ impl AsRust<IntentParserResult> for CIntentParserResult {
51
51
impl Drop for CIntentParserResult {
52
52
fn drop ( & mut self ) {
53
53
take_back_c_string ! ( self . input) ;
54
- unsafe { CIntentClassifierResult :: drop_raw_pointer ( self . intent ) } ;
55
- unsafe { CSlotList :: drop_raw_pointer ( self . slots ) } ;
56
- unsafe { CIntentParserAlternativeArray :: drop_raw_pointer ( self . alternatives ) } ;
54
+ let _ = unsafe { CIntentClassifierResult :: drop_raw_pointer ( self . intent ) } ;
55
+ let _ = unsafe { CSlotList :: drop_raw_pointer ( self . slots ) } ;
56
+ let _ = unsafe { CIntentParserAlternativeArray :: drop_raw_pointer ( self . alternatives ) } ;
57
57
}
58
58
}
59
59
@@ -87,8 +87,8 @@ impl AsRust<IntentParserAlternative> for CIntentParserAlternative {
87
87
88
88
impl Drop for CIntentParserAlternative {
89
89
fn drop ( & mut self ) {
90
- unsafe { CIntentClassifierResult :: drop_raw_pointer ( self . intent ) } ;
91
- unsafe { CSlotList :: drop_raw_pointer ( self . slots ) } ;
90
+ let _ = unsafe { CIntentClassifierResult :: drop_raw_pointer ( self . intent ) } ;
91
+ let _ = unsafe { CSlotList :: drop_raw_pointer ( self . slots ) } ;
92
92
}
93
93
}
94
94
@@ -99,13 +99,13 @@ pub struct CIntentParserAlternativeArray {
99
99
/// Pointer to the first result of the list
100
100
pub intent_parser_alternatives : * const CIntentParserAlternative ,
101
101
/// Number of results in the list
102
- pub size : libc :: int32_t ,
102
+ pub size : i32 ,
103
103
}
104
104
105
105
impl From < Vec < IntentParserAlternative > > for CIntentParserAlternativeArray {
106
106
fn from ( input : Vec < IntentParserAlternative > ) -> Self {
107
107
Self {
108
- size : input. len ( ) as libc :: int32_t ,
108
+ size : input. len ( ) as i32 ,
109
109
intent_parser_alternatives : Box :: into_raw (
110
110
input
111
111
. into_iter ( )
@@ -190,13 +190,13 @@ pub struct CIntentClassifierResultArray {
190
190
/// Pointer to the first result of the list
191
191
pub intent_classifier_results : * const CIntentClassifierResult ,
192
192
/// Number of results in the list
193
- pub size : libc :: int32_t ,
193
+ pub size : i32 ,
194
194
}
195
195
196
196
impl From < Vec < IntentClassifierResult > > for CIntentClassifierResultArray {
197
197
fn from ( input : Vec < IntentClassifierResult > ) -> Self {
198
198
Self {
199
- size : input. len ( ) as libc :: int32_t ,
199
+ size : input. len ( ) as i32 ,
200
200
intent_classifier_results : Box :: into_raw (
201
201
input
202
202
. into_iter ( )
@@ -243,13 +243,13 @@ pub struct CSlotList {
243
243
/// Pointer to the first slot of the list
244
244
pub slots : * const CSlot ,
245
245
/// Number of slots in the list
246
- pub size : libc :: int32_t , // Note: we can't use `libc::size_t` because it's not supported by JNA
246
+ pub size : i32 , // Note: we can't use `libc::size_t` because it's not supported by JNA
247
247
}
248
248
249
249
impl From < Vec < Slot > > for CSlotList {
250
250
fn from ( input : Vec < Slot > ) -> Self {
251
251
Self {
252
- size : input. len ( ) as libc :: int32_t ,
252
+ size : input. len ( ) as i32 ,
253
253
slots : Box :: into_raw (
254
254
input
255
255
. into_iter ( )
@@ -300,9 +300,9 @@ pub struct CSlot {
300
300
/// Name of the slot
301
301
pub slot_name : * const libc:: c_char ,
302
302
/// Start index of raw value in input text
303
- pub range_start : libc :: int32_t ,
303
+ pub range_start : i32 ,
304
304
/// End index of raw value in input text
305
- pub range_end : libc :: int32_t ,
305
+ pub range_end : i32 ,
306
306
/// Confidence score of the slot
307
307
pub confidence_score : libc:: c_float ,
308
308
}
@@ -313,8 +313,8 @@ impl From<Slot> for CSlot {
313
313
raw_value : CString :: new ( input. raw_value ) . unwrap ( ) . into_raw ( ) ,
314
314
value : CSlotValue :: from ( input. value ) . into_raw_pointer ( ) ,
315
315
alternatives : CSlotValueArray :: from ( input. alternatives ) . into_raw_pointer ( ) ,
316
- range_start : input. range . start as libc :: int32_t ,
317
- range_end : input. range . end as libc :: int32_t ,
316
+ range_start : input. range . start as i32 ,
317
+ range_end : input. range . end as i32 ,
318
318
entity : CString :: new ( input. entity ) . unwrap ( ) . into_raw ( ) ,
319
319
slot_name : CString :: new ( input. slot_name ) . unwrap ( ) . into_raw ( ) ,
320
320
confidence_score : input
@@ -348,8 +348,8 @@ impl Drop for CSlot {
348
348
take_back_c_string ! ( self . raw_value) ;
349
349
take_back_c_string ! ( self . entity) ;
350
350
take_back_c_string ! ( self . slot_name) ;
351
- unsafe { CSlotValue :: drop_raw_pointer ( self . value ) } ;
352
- unsafe { CSlotValueArray :: drop_raw_pointer ( self . alternatives ) } ;
351
+ let _ = unsafe { CSlotValue :: drop_raw_pointer ( self . value ) } ;
352
+ let _ = unsafe { CSlotValueArray :: drop_raw_pointer ( self . alternatives ) } ;
353
353
}
354
354
}
355
355
@@ -448,7 +448,7 @@ pub type CNumberValue = libc::c_double;
448
448
/// Representation of a percentage value
449
449
pub type CPercentageValue = libc:: c_double ;
450
450
/// Representation of an ordinal value
451
- pub type COrdinalValue = libc :: int64_t ;
451
+ pub type COrdinalValue = i64 ;
452
452
453
453
/// Enum representing the grain of a resolved date related value
454
454
#[ repr( C ) ]
@@ -668,36 +668,36 @@ impl Drop for CTemperatureValue {
668
668
#[ derive( Debug ) ]
669
669
pub struct CDurationValue {
670
670
/// Number of years in the duration
671
- pub years : libc :: int64_t ,
671
+ pub years : i64 ,
672
672
/// Number of quarters in the duration
673
- pub quarters : libc :: int64_t ,
673
+ pub quarters : i64 ,
674
674
/// Number of months in the duration
675
- pub months : libc :: int64_t ,
675
+ pub months : i64 ,
676
676
/// Number of weeks in the duration
677
- pub weeks : libc :: int64_t ,
677
+ pub weeks : i64 ,
678
678
/// Number of days in the duration
679
- pub days : libc :: int64_t ,
679
+ pub days : i64 ,
680
680
/// Number of hours in the duration
681
- pub hours : libc :: int64_t ,
681
+ pub hours : i64 ,
682
682
/// Number of minutes in the duration
683
- pub minutes : libc :: int64_t ,
683
+ pub minutes : i64 ,
684
684
/// Number of seconds in the duration
685
- pub seconds : libc :: int64_t ,
685
+ pub seconds : i64 ,
686
686
/// Precision of the resolved value
687
687
pub precision : SNIPS_PRECISION ,
688
688
}
689
689
690
690
impl From < DurationValue > for CDurationValue {
691
691
fn from ( value : DurationValue ) -> Self {
692
692
Self {
693
- years : value. years as libc :: int64_t ,
694
- quarters : value. quarters as libc :: int64_t ,
695
- months : value. months as libc :: int64_t ,
696
- weeks : value. weeks as libc :: int64_t ,
697
- days : value. days as libc :: int64_t ,
698
- hours : value. hours as libc :: int64_t ,
699
- minutes : value. minutes as libc :: int64_t ,
700
- seconds : value. seconds as libc :: int64_t ,
693
+ years : value. years as i64 ,
694
+ quarters : value. quarters as i64 ,
695
+ months : value. months as i64 ,
696
+ weeks : value. weeks as i64 ,
697
+ days : value. days as i64 ,
698
+ hours : value. hours as i64 ,
699
+ minutes : value. minutes as i64 ,
700
+ seconds : value. seconds as i64 ,
701
701
precision : SNIPS_PRECISION :: from ( value. precision ) ,
702
702
}
703
703
}
@@ -827,7 +827,7 @@ impl AsRust<SlotValue> for CSlotValue {
827
827
828
828
impl Drop for CSlotValue {
829
829
fn drop ( & mut self ) {
830
- unsafe {
830
+ let _ = unsafe {
831
831
match self . value_type {
832
832
SNIPS_SLOT_VALUE_TYPE :: SNIPS_SLOT_VALUE_TYPE_CUSTOM => {
833
833
CString :: drop_raw_pointer ( self . value )
@@ -886,13 +886,13 @@ pub struct CSlotValueArray {
886
886
/// Pointer to the first slot value of the list
887
887
pub slot_values : * const CSlotValue ,
888
888
/// Number of slot values in the list
889
- pub size : libc :: int32_t , // Note: we can't use `libc::size_t` because it's not supported by JNA
889
+ pub size : i32 , // Note: we can't use `libc::size_t` because it's not supported by JNA
890
890
}
891
891
892
892
impl From < Vec < SlotValue > > for CSlotValueArray {
893
893
fn from ( input : Vec < SlotValue > ) -> Self {
894
894
Self {
895
- size : input. len ( ) as libc :: int32_t ,
895
+ size : input. len ( ) as i32 ,
896
896
slot_values : Box :: into_raw (
897
897
input
898
898
. into_iter ( )
0 commit comments