Skip to content

Commit f5d83c3

Browse files
committed
Use required-features to gate expressions example with tensorflow_unstable feature
Fixes #64
1 parent 3fbd27f commit f5d83c3

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

Cargo.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,16 @@ random = "0.12"
2121
tensorflow_unstable = []
2222

2323
[workspace]
24+
25+
[[example]]
26+
name = "addition"
27+
28+
[[example]]
29+
name = "expressions"
30+
required-features = ["tensorflow_unstable"]
31+
32+
[[example]]
33+
name = "regression"
34+
35+
[[example]]
36+
name = "regression_savedmodel"

examples/expressions.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ use std::error::Error;
55
use std::result::Result;
66
use std::process::exit;
77
use tensorflow::Code;
8-
// Workaround for https://github.com/rust-lang/cargo/issues/1570
9-
#[cfg(feature = "tensorflow_unstable")]
108
use tensorflow::expr::{Compiler, Placeholder};
119
use tensorflow::Graph;
1210
use tensorflow::Session;
@@ -60,16 +58,6 @@ impl Checker {
6058
}
6159
}
6260

63-
// Workaround for https://github.com/rust-lang/cargo/issues/1570
64-
#[cfg(not(feature = "tensorflow_unstable"))]
65-
fn run() -> Result<(), Box<Error>> {
66-
println!("examples/expressions.rs is disabled because the `tensorflow_unstable` feature is \
67-
not enabled!");
68-
Ok(())
69-
}
70-
71-
// Workaround for https://github.com/rust-lang/cargo/issues/1570
72-
#[cfg(feature = "tensorflow_unstable")]
7361
fn run() -> Result<(), Box<Error>> {
7462
// Build the graph
7563
let mut g = Graph::new();

0 commit comments

Comments
 (0)