Skip to content

Commit

Permalink
Fix clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
adamcrume committed Jul 23, 2023
1 parent 6992423 commit bb629e3
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ rustversion = "1.0.9"
[dev-dependencies]
rand = "0.8.5"
serial_test = "0.9.0"
tempdir = "0.3"
tempfile = "3.7.0"

[features]
default = ["tensorflow-sys"]
Expand Down
5 changes: 2 additions & 3 deletions src/checkpoint.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use crate::option_insert_result::OptionInsertWithResult;
use crate::{ops, Operation, Scope, Session, SessionRunArgs, Status, Tensor, Variable};

#[derive(Debug)]
Expand Down Expand Up @@ -92,7 +91,7 @@ impl CheckpointMaker {
)?;
let tensors = all_variable_ops
.iter()
.map(|v| v.output(0).clone())
.map(|v| v.output(0))
.collect::<Vec<_>>();

let mut g = self.scope.graph_mut();
Expand Down Expand Up @@ -355,7 +354,7 @@ mod tests {
first_scope_data.scope.new_sub_scope("checkpoint"),
Box::from(first_scope_data.variables.clone()),
);
let temp_dir = tempdir::TempDir::new("test-tensorflow")?;
let temp_dir = tempfile::tempdir()?;
let checkpoint_path = temp_dir.path().join("checkpoint-vars");
let checkpoint_path_str = checkpoint_path
.into_os_string()
Expand Down
2 changes: 2 additions & 0 deletions src/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1340,6 +1340,7 @@ impl Operation {
return Err(status);
}
#[allow(trivial_numeric_casts)]
#[allow(clippy::unnecessary_cast)]
Ok(value as f32)
}

Expand Down Expand Up @@ -1367,6 +1368,7 @@ impl Operation {
return Err(status);
}
#[allow(trivial_numeric_casts)]
#[allow(clippy::unnecessary_cast)]
Ok(values.iter().map(|f| f.assume_init() as f32).collect())
}
}
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1202,6 +1202,7 @@ where
{
// This will panic if `unpacked` is false and `unpacked_data` is already borrowed.
#[allow(trivial_numeric_casts)]
#[allow(clippy::unnecessary_cast)]
fn unpack(&self) {
if !self.unpacked.get() {
let mut data = self.unpacked_data.borrow_mut();
Expand Down
1 change: 0 additions & 1 deletion tensorflow-op-codegen/src/bin/eager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,6 @@ fn main() -> Result<(), Box<dyn Error>> {
let mut out = BufWriter::new(File::create(output_folder.join("src/eager/op/raw_ops.rs"))?);
write!(
&mut out,
"{}",
r#"// DO NOT EDIT. Generated by tensorflow-op-codegen/src/main.rs.
"#
Expand Down
1 change: 0 additions & 1 deletion tensorflow-op-codegen/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,6 @@ fn main() -> Result<(), Box<dyn Error>> {
let mut out = BufWriter::new(File::create(output_folder.join("src/ops/ops_impl.rs"))?);
write!(
&mut out,
"{}",
r#"// DO NOT EDIT. Generated by tensorflow-op-codegen/src/main.rs.
#![allow(
non_snake_case,
Expand Down

0 comments on commit bb629e3

Please sign in to comment.