@@ -167,10 +167,7 @@ impl ImportGraphDefOptions {
167
167
/// unique. Defaults to false.
168
168
pub fn set_uniquify_names ( & mut self , uniquify_names : bool ) {
169
169
unsafe {
170
- tf:: TF_ImportGraphDefOptionsSetUniquifyNames (
171
- self . inner ,
172
- if uniquify_names { 1 } else { 0 } ,
173
- ) ;
170
+ tf:: TF_ImportGraphDefOptionsSetUniquifyNames ( self . inner , u8:: from ( uniquify_names) ) ;
174
171
}
175
172
}
176
173
@@ -179,10 +176,7 @@ impl ImportGraphDefOptions {
179
176
/// treated as an error. This option has no effect if no prefix is specified.
180
177
pub fn set_uniquify_prefix ( & mut self , uniquify_prefix : bool ) {
181
178
unsafe {
182
- tf:: TF_ImportGraphDefOptionsSetUniquifyPrefix (
183
- self . inner ,
184
- if uniquify_prefix { 1 } else { 0 } ,
185
- ) ;
179
+ tf:: TF_ImportGraphDefOptionsSetUniquifyPrefix ( self . inner , u8:: from ( uniquify_prefix) ) ;
186
180
}
187
181
}
188
182
@@ -693,7 +687,7 @@ impl Graph {
693
687
tf:: TF_GraphToFunction (
694
688
self . inner ( ) ,
695
689
fn_name_cstr. as_ptr ( ) ,
696
- if append_hash_to_fn_name { 1 } else { 0 } ,
690
+ u8 :: from ( append_hash_to_fn_name) ,
697
691
num_opers,
698
692
c_opers_ptr,
699
693
c_inputs. len ( ) as c_int ,
@@ -2033,7 +2027,7 @@ impl<'a> OperationDescription<'a> {
2033
2027
) -> std:: result:: Result < ( ) , NulError > {
2034
2028
let c_attr_name = CString :: new ( attr_name) ?;
2035
2029
unsafe {
2036
- tf:: TF_SetAttrBool ( self . inner , c_attr_name. as_ptr ( ) , if value { 1 } else { 0 } ) ;
2030
+ tf:: TF_SetAttrBool ( self . inner , c_attr_name. as_ptr ( ) , u8 :: from ( value) ) ;
2037
2031
}
2038
2032
Ok ( ( ) )
2039
2033
}
@@ -2045,7 +2039,7 @@ impl<'a> OperationDescription<'a> {
2045
2039
value : & [ bool ] ,
2046
2040
) -> std:: result:: Result < ( ) , NulError > {
2047
2041
let c_attr_name = CString :: new ( attr_name) ?;
2048
- let c_value: Vec < c_uchar > = value. iter ( ) . map ( |x| if * x { 1 } else { 0 } ) . collect ( ) ;
2042
+ let c_value: Vec < c_uchar > = value. iter ( ) . map ( |x| u8 :: from ( * x ) ) . collect ( ) ;
2049
2043
unsafe {
2050
2044
tf:: TF_SetAttrBoolList (
2051
2045
self . inner ,
0 commit comments