Auto merge of #6649 - pietroalbini:change-unfixable-warning, r=dwijnand

Switch from unused_imports to deprecated to test unfixable warnings

The `unused_imports` warning is going to emit fixable suggestions in the near future, but that means parts of the cargo's test suite will break. This commit switches the tests to use the `deprecated` warning, which *shouldn't* be fixable at all.
This commit is contained in:
bors 2019-02-10 15:49:37 +00:00
commit 865cb70106

View File

@ -702,11 +702,11 @@ fn fix_features() {
#[test] #[test]
fn shows_warnings() { fn shows_warnings() {
let p = project() let p = project()
.file("src/lib.rs", "use std::default::Default; pub fn foo() {}") .file("src/lib.rs", "#[deprecated] fn bar() {} pub fn foo() { let _ = bar(); }")
.build(); .build();
p.cargo("fix --allow-no-vcs") p.cargo("fix --allow-no-vcs")
.with_stderr_contains("[..]warning: unused import[..]") .with_stderr_contains("[..]warning: use of deprecated item[..]")
.run(); .run();
} }
@ -982,20 +982,22 @@ fn shows_warnings_on_second_run_without_changes() {
.file( .file(
"src/lib.rs", "src/lib.rs",
r#" r#"
use std::default::Default; #[deprecated]
fn bar() {}
pub fn foo() { pub fn foo() {
let _ = bar();
} }
"#, "#,
) )
.build(); .build();
p.cargo("fix --allow-no-vcs") p.cargo("fix --allow-no-vcs")
.with_stderr_contains("[..]warning: unused import[..]") .with_stderr_contains("[..]warning: use of deprecated item[..]")
.run(); .run();
p.cargo("fix --allow-no-vcs") p.cargo("fix --allow-no-vcs")
.with_stderr_contains("[..]warning: unused import[..]") .with_stderr_contains("[..]warning: use of deprecated item[..]")
.run(); .run();
} }
@ -1005,65 +1007,76 @@ fn shows_warnings_on_second_run_without_changes_on_multiple_targets() {
.file( .file(
"src/lib.rs", "src/lib.rs",
r#" r#"
use std::default::Default; #[deprecated]
fn bar() {}
pub fn a() -> u32 { 3 } pub fn foo() {
let _ = bar();
}
"#, "#,
) )
.file( .file(
"src/main.rs", "src/main.rs",
r#" r#"
use std::default::Default; #[deprecated]
fn main() { println!("3"); } fn bar() {}
fn main() {
let _ = bar();
}
"#, "#,
) )
.file( .file(
"tests/foo.rs", "tests/foo.rs",
r#" r#"
use std::default::Default; #[deprecated]
fn bar() {}
#[test] #[test]
fn foo_test() { fn foo_test() {
println!("3"); let _ = bar();
} }
"#, "#,
) )
.file( .file(
"tests/bar.rs", "tests/bar.rs",
r#" r#"
use std::default::Default; #[deprecated]
fn bar() {}
#[test] #[test]
fn foo_test() { fn foo_test() {
println!("3"); let _ = bar();
} }
"#, "#,
) )
.file( .file(
"examples/fooxample.rs", "examples/fooxample.rs",
r#" r#"
use std::default::Default; #[deprecated]
fn bar() {}
fn main() { fn main() {
println!("3"); let _ = bar();
} }
"#, "#,
) )
.build(); .build();
p.cargo("fix --allow-no-vcs --all-targets") p.cargo("fix --allow-no-vcs --all-targets")
.with_stderr_contains(" --> examples/fooxample.rs:2:21") .with_stderr_contains(" --> examples/fooxample.rs:6:29")
.with_stderr_contains(" --> src/lib.rs:2:21") .with_stderr_contains(" --> src/lib.rs:6:29")
.with_stderr_contains(" --> src/main.rs:2:21") .with_stderr_contains(" --> src/main.rs:6:29")
.with_stderr_contains(" --> tests/bar.rs:2:21") .with_stderr_contains(" --> tests/bar.rs:7:29")
.with_stderr_contains(" --> tests/foo.rs:2:21") .with_stderr_contains(" --> tests/foo.rs:7:29")
.run(); .run();
p.cargo("fix --allow-no-vcs --all-targets") p.cargo("fix --allow-no-vcs --all-targets")
.with_stderr_contains(" --> examples/fooxample.rs:2:21") .with_stderr_contains(" --> examples/fooxample.rs:6:29")
.with_stderr_contains(" --> src/lib.rs:2:21") .with_stderr_contains(" --> src/lib.rs:6:29")
.with_stderr_contains(" --> src/main.rs:2:21") .with_stderr_contains(" --> src/main.rs:6:29")
.with_stderr_contains(" --> tests/bar.rs:2:21") .with_stderr_contains(" --> tests/bar.rs:7:29")
.with_stderr_contains(" --> tests/foo.rs:2:21") .with_stderr_contains(" --> tests/foo.rs:7:29")
.run(); .run();
} }