@@ -167,10 +167,7 @@ impl ImportGraphDefOptions {
167167 /// unique. Defaults to false.
168168 pub fn set_uniquify_names ( & mut self , uniquify_names : bool ) {
169169 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) ) ;
174171 }
175172 }
176173
@@ -179,10 +176,7 @@ impl ImportGraphDefOptions {
179176 /// treated as an error. This option has no effect if no prefix is specified.
180177 pub fn set_uniquify_prefix ( & mut self , uniquify_prefix : bool ) {
181178 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) ) ;
186180 }
187181 }
188182
@@ -693,7 +687,7 @@ impl Graph {
693687 tf:: TF_GraphToFunction (
694688 self . inner ( ) ,
695689 fn_name_cstr. as_ptr ( ) ,
696- if append_hash_to_fn_name { 1 } else { 0 } ,
690+ u8 :: from ( append_hash_to_fn_name) ,
697691 num_opers,
698692 c_opers_ptr,
699693 c_inputs. len ( ) as c_int ,
@@ -2033,7 +2027,7 @@ impl<'a> OperationDescription<'a> {
20332027 ) -> std:: result:: Result < ( ) , NulError > {
20342028 let c_attr_name = CString :: new ( attr_name) ?;
20352029 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) ) ;
20372031 }
20382032 Ok ( ( ) )
20392033 }
@@ -2045,7 +2039,7 @@ impl<'a> OperationDescription<'a> {
20452039 value : & [ bool ] ,
20462040 ) -> std:: result:: Result < ( ) , NulError > {
20472041 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 ( ) ;
20492043 unsafe {
20502044 tf:: TF_SetAttrBoolList (
20512045 self . inner ,
0 commit comments