Commit af25096
authored
[rust template] Add cfg(test) attribute to mod test (#1342)
Got this error:
```
cargo run .
Compiling rust-stable-hello-world v0.1.0 (/home/savil/repo/rust)
warning: unused import: `super::*`
--> src/main.rs:10:7
|
10 | use super::*;
| ^^^^^^^^
|
help: consider adding a `#[cfg(test)]` to the containing module
--> src/main.rs:9:1
|
9 | mod tests {
| ^^^^^^^^^
= note: `#[warn(unused_imports)]` on by default
```
Afterwards:
```
❯ cargo test
Compiling rust-stable-hello-world v0.1.0 (/home/savil/repo/rust)
Finished test [unoptimized + debuginfo] target(s) in 0.25s
Running unittests src/main.rs (target/debug/deps/rust_stable_hello_world-5499c8f65b21de0b)
running 1 test
test tests::test_hello_world ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
~/repo/rust is 📦 v0.1.0 via 🦀 v1.71.0 via ❄️ impure (nix-shell-env)
❯ cargo run
Compiling rust-stable-hello-world v0.1.0 (/home/savil/repo/rust)
Finished dev [unoptimized + debuginfo] target(s) in 0.15s
Running `target/debug/rust-stable-hello-world`
Hello, world!
```
## Summary
## How was it tested?
Signed-off-by: savil <[email protected]>1 parent 767becb commit af25096
File tree
1 file changed
+1
-0
lines changed- examples/development/rust/rust-stable-hello-world/src
1 file changed
+1
-0
lines changedLines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
0 commit comments