Skip to content

Commit bb629e3

Browse files
committed
Fix clippy lints
1 parent 6992423 commit bb629e3

File tree

6 files changed

+6
-6
lines changed

6 files changed

+6
-6
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ rustversion = "1.0.9"
3737
[dev-dependencies]
3838
rand = "0.8.5"
3939
serial_test = "0.9.0"
40-
tempdir = "0.3"
40+
tempfile = "3.7.0"
4141

4242
[features]
4343
default = ["tensorflow-sys"]

src/checkpoint.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use crate::option_insert_result::OptionInsertWithResult;
21
use crate::{ops, Operation, Scope, Session, SessionRunArgs, Status, Tensor, Variable};
32

43
#[derive(Debug)]
@@ -92,7 +91,7 @@ impl CheckpointMaker {
9291
)?;
9392
let tensors = all_variable_ops
9493
.iter()
95-
.map(|v| v.output(0).clone())
94+
.map(|v| v.output(0))
9695
.collect::<Vec<_>>();
9796

9897
let mut g = self.scope.graph_mut();
@@ -355,7 +354,7 @@ mod tests {
355354
first_scope_data.scope.new_sub_scope("checkpoint"),
356355
Box::from(first_scope_data.variables.clone()),
357356
);
358-
let temp_dir = tempdir::TempDir::new("test-tensorflow")?;
357+
let temp_dir = tempfile::tempdir()?;
359358
let checkpoint_path = temp_dir.path().join("checkpoint-vars");
360359
let checkpoint_path_str = checkpoint_path
361360
.into_os_string()

src/graph.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,6 +1340,7 @@ impl Operation {
13401340
return Err(status);
13411341
}
13421342
#[allow(trivial_numeric_casts)]
1343+
#[allow(clippy::unnecessary_cast)]
13431344
Ok(value as f32)
13441345
}
13451346

@@ -1367,6 +1368,7 @@ impl Operation {
13671368
return Err(status);
13681369
}
13691370
#[allow(trivial_numeric_casts)]
1371+
#[allow(clippy::unnecessary_cast)]
13701372
Ok(values.iter().map(|f| f.assume_init() as f32).collect())
13711373
}
13721374
}

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,6 +1202,7 @@ where
12021202
{
12031203
// This will panic if `unpacked` is false and `unpacked_data` is already borrowed.
12041204
#[allow(trivial_numeric_casts)]
1205+
#[allow(clippy::unnecessary_cast)]
12051206
fn unpack(&self) {
12061207
if !self.unpacked.get() {
12071208
let mut data = self.unpacked_data.borrow_mut();

tensorflow-op-codegen/src/bin/eager.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,6 @@ fn main() -> Result<(), Box<dyn Error>> {
731731
let mut out = BufWriter::new(File::create(output_folder.join("src/eager/op/raw_ops.rs"))?);
732732
write!(
733733
&mut out,
734-
"{}",
735734
r#"// DO NOT EDIT. Generated by tensorflow-op-codegen/src/main.rs.
736735
737736
"#

tensorflow-op-codegen/src/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,6 @@ fn main() -> Result<(), Box<dyn Error>> {
798798
let mut out = BufWriter::new(File::create(output_folder.join("src/ops/ops_impl.rs"))?);
799799
write!(
800800
&mut out,
801-
"{}",
802801
r#"// DO NOT EDIT. Generated by tensorflow-op-codegen/src/main.rs.
803802
#![allow(
804803
non_snake_case,

0 commit comments

Comments
 (0)