cargo/tests/testsuite/lints/unknown_lints.rs

91 lines
1.9 KiB
Rust

use crate::prelude::*;
use cargo_test_support::project;
use cargo_test_support::str;
#[cargo_test]
fn default() {
let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.0.1"
edition = "2015"
authors = []
[lints.cargo]
this-lint-does-not-exist = "warn"
"#,
)
.file("src/lib.rs", "")
.build();
p.cargo("check -Zcargo-lints")
.masquerade_as_nightly_cargo(&["cargo-lints"])
.with_stderr_data(str![[r#"
[WARNING] unknown lint: `this-lint-does-not-exist`
--> Cargo.toml:9:1
|
9 | this-lint-does-not-exist = "warn"
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= [NOTE] `cargo::unknown_lints` is set to `warn` by default
[CHECKING] foo v0.0.1 ([ROOT]/foo)
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
"#]])
.run();
}
#[cargo_test]
fn inherited() {
let p = project()
.file(
"Cargo.toml",
r#"
[workspace]
members = ["foo"]
[workspace.lints.cargo]
this-lint-does-not-exist = "warn"
"#,
)
.file(
"foo/Cargo.toml",
r#"
[package]
name = "foo"
version = "0.0.1"
edition = "2015"
authors = []
[lints]
workspace = true
"#,
)
.file("foo/src/lib.rs", "")
.build();
p.cargo("check -Zcargo-lints")
.masquerade_as_nightly_cargo(&["cargo-lints"])
.with_stderr_data(str![[r#"
[WARNING] unknown lint: `this-lint-does-not-exist`
--> Cargo.toml:6:1
|
6 | this-lint-does-not-exist = "warn"
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= [NOTE] `cargo::unknown_lints` is set to `warn` by default
[NOTE] `cargo::this-lint-does-not-exist` was inherited
--> foo/Cargo.toml:9:1
|
9 | workspace = true
| ----------------
[CHECKING] foo v0.0.1 ([ROOT]/foo/foo)
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
"#]])
.run();
}