When I run cargo test one_result
, I see the following warning:
Full Log
❯ cargo test one_result
warning: unused variable: `query`
--> src/lib.rs:31:19
|
31 | pub fn search<'a>(query: &str, contents: &'a str) -> Vec<&'a str> {
| ^^^^^ help: if this is intentional, prefix it with an underscore: `_query`
|
= note: `#[warn(unused_variables)]` on by default
warning: unused variable: `contents`
--> src/lib.rs:31:32
|
31 | pub fn search<'a>(query: &str, contents: &'a str) -> Vec<&'a str> {
| ^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_contents`
warning: 2 warnings emitted
warning: unused variable: `query`
--> src/lib.rs:31:19
|
31 | pub fn search<'a>(query: &str, contents: &'a str) -> Vec<&'a str> {
| ^^^^^ help: if this is intentional, prefix it with an underscore: `_query`
|
= note: `#[warn(unused_variables)]` on by default
warning: unused variable: `contents`
--> src/lib.rs:31:32
|
31 | pub fn search<'a>(query: &str, contents: &'a str) -> Vec<&'a str> {
| ^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_contents`
warning: 2 warnings emitted
Finished test [unoptimized + debuginfo] target(s) in 0.00s
Running unittests (target/debug/deps/minigrep-b6590e6e31b9e448)
running 1 test
test test::one_result ... FAILED
failures:
---- test::one_result stdout ----
thread 'test::one_result' panicked at 'assertion failed: `(left == right)`
left: `["safe, fast, productive."]`,
right: `[]`', src/lib.rs:76:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failures:
test::one_result
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 3 filtered out; finished in 0.00s
error: test failed, to rerun pass '--lib'
Why is that?