Skip to content

Commit f6cb5bc

Browse files
committed
Fix clippy and audit issues
1 parent a7a4dad commit f6cb5bc

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/graph.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ impl ImportGraphDefOptions {
169169
unsafe {
170170
tf::TF_ImportGraphDefOptionsSetUniquifyNames(
171171
self.inner,
172-
if uniquify_names { 1 } else { 0 },
172+
u8::from(uniquify_names),
173173
);
174174
}
175175
}
@@ -181,7 +181,7 @@ impl ImportGraphDefOptions {
181181
unsafe {
182182
tf::TF_ImportGraphDefOptionsSetUniquifyPrefix(
183183
self.inner,
184-
if uniquify_prefix { 1 } else { 0 },
184+
u8::from(uniquify_prefix),
185185
);
186186
}
187187
}
@@ -693,7 +693,7 @@ impl Graph {
693693
tf::TF_GraphToFunction(
694694
self.inner(),
695695
fn_name_cstr.as_ptr(),
696-
if append_hash_to_fn_name { 1 } else { 0 },
696+
u8::from(append_hash_to_fn_name),
697697
num_opers,
698698
c_opers_ptr,
699699
c_inputs.len() as c_int,
@@ -2033,7 +2033,7 @@ impl<'a> OperationDescription<'a> {
20332033
) -> std::result::Result<(), NulError> {
20342034
let c_attr_name = CString::new(attr_name)?;
20352035
unsafe {
2036-
tf::TF_SetAttrBool(self.inner, c_attr_name.as_ptr(), if value { 1 } else { 0 });
2036+
tf::TF_SetAttrBool(self.inner, c_attr_name.as_ptr(), u8::from(value));
20372037
}
20382038
Ok(())
20392039
}
@@ -2045,7 +2045,7 @@ impl<'a> OperationDescription<'a> {
20452045
value: &[bool],
20462046
) -> std::result::Result<(), NulError> {
20472047
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();
2048+
let c_value: Vec<c_uchar> = value.iter().map(|x| u8::from(*x)).collect();
20492049
unsafe {
20502050
tf::TF_SetAttrBoolList(
20512051
self.inner,

tensorflow-sys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ flate2 = "1.0.24"
3131
pkg-config = "0.3.25"
3232
semver = "1.0.13"
3333
tar = "0.4.38"
34-
zip = "0.6.2"
34+
zip = "0.6.4"
3535

3636
[features]
3737
tensorflow_gpu = []

tensorflow-sys/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ fn extract_zip<P: AsRef<Path>, P2: AsRef<Path>>(archive_path: P, extract_to: P2)
164164
} else {
165165
if let Some(parent) = output_path.parent() {
166166
if !parent.exists() {
167-
fs::create_dir_all(&parent)
167+
fs::create_dir_all(parent)
168168
.expect("Failed to create parent directory for extracted file.");
169169
}
170170
}
@@ -266,7 +266,7 @@ fn install_prebuilt() {
266266
let framework_files = std::fs::read_dir(lib_dir).unwrap();
267267
for library_entry in framework_files.filter_map(Result::ok) {
268268
let library_full_path = library_entry.path();
269-
let new_library_full_path = output.join(&library_full_path.file_name().unwrap());
269+
let new_library_full_path = output.join(library_full_path.file_name().unwrap());
270270
if new_library_full_path.exists() {
271271
log!(
272272
"{} already exists. Removing",

0 commit comments

Comments
 (0)