Skip to content

Commit

Permalink
Fix clippy and audit issues
Browse files Browse the repository at this point in the history
  • Loading branch information
adamcrume committed Feb 12, 2023
1 parent a7a4dad commit f6cb5bc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ impl ImportGraphDefOptions {
unsafe {
tf::TF_ImportGraphDefOptionsSetUniquifyNames(
self.inner,
if uniquify_names { 1 } else { 0 },
u8::from(uniquify_names),
);
}
}
Expand All @@ -181,7 +181,7 @@ impl ImportGraphDefOptions {
unsafe {
tf::TF_ImportGraphDefOptionsSetUniquifyPrefix(
self.inner,
if uniquify_prefix { 1 } else { 0 },
u8::from(uniquify_prefix),
);
}
}
Expand Down Expand Up @@ -693,7 +693,7 @@ impl Graph {
tf::TF_GraphToFunction(
self.inner(),
fn_name_cstr.as_ptr(),
if append_hash_to_fn_name { 1 } else { 0 },
u8::from(append_hash_to_fn_name),
num_opers,
c_opers_ptr,
c_inputs.len() as c_int,
Expand Down Expand Up @@ -2033,7 +2033,7 @@ impl<'a> OperationDescription<'a> {
) -> std::result::Result<(), NulError> {
let c_attr_name = CString::new(attr_name)?;
unsafe {
tf::TF_SetAttrBool(self.inner, c_attr_name.as_ptr(), if value { 1 } else { 0 });
tf::TF_SetAttrBool(self.inner, c_attr_name.as_ptr(), u8::from(value));
}
Ok(())
}
Expand All @@ -2045,7 +2045,7 @@ impl<'a> OperationDescription<'a> {
value: &[bool],
) -> std::result::Result<(), NulError> {
let c_attr_name = CString::new(attr_name)?;
let c_value: Vec<c_uchar> = value.iter().map(|x| if *x { 1 } else { 0 }).collect();
let c_value: Vec<c_uchar> = value.iter().map(|x| u8::from(*x)).collect();
unsafe {
tf::TF_SetAttrBoolList(
self.inner,
Expand Down
2 changes: 1 addition & 1 deletion tensorflow-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ flate2 = "1.0.24"
pkg-config = "0.3.25"
semver = "1.0.13"
tar = "0.4.38"
zip = "0.6.2"
zip = "0.6.4"

[features]
tensorflow_gpu = []
Expand Down
4 changes: 2 additions & 2 deletions tensorflow-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ fn extract_zip<P: AsRef<Path>, P2: AsRef<Path>>(archive_path: P, extract_to: P2)
} else {
if let Some(parent) = output_path.parent() {
if !parent.exists() {
fs::create_dir_all(&parent)
fs::create_dir_all(parent)
.expect("Failed to create parent directory for extracted file.");
}
}
Expand Down Expand Up @@ -266,7 +266,7 @@ fn install_prebuilt() {
let framework_files = std::fs::read_dir(lib_dir).unwrap();
for library_entry in framework_files.filter_map(Result::ok) {
let library_full_path = library_entry.path();
let new_library_full_path = output.join(&library_full_path.file_name().unwrap());
let new_library_full_path = output.join(library_full_path.file_name().unwrap());
if new_library_full_path.exists() {
log!(
"{} already exists. Removing",
Expand Down

0 comments on commit f6cb5bc

Please sign in to comment.