-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cargo-lints): Add a lint for unknown_lints
- Loading branch information
Showing
8 changed files
with
368 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
mod implicit_features; | ||
mod unknown_lints; | ||
mod unused_optional_dependencies; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use cargo_test_support::prelude::*; | ||
use cargo_test_support::str; | ||
use cargo_test_support::{file, project}; | ||
|
||
#[cargo_test] | ||
fn case() { | ||
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(); | ||
|
||
snapbox::cmd::Command::cargo_ui() | ||
.masquerade_as_nightly_cargo(&["cargo-lints"]) | ||
.current_dir(p.root()) | ||
.arg("check") | ||
.arg("-Zcargo-lints") | ||
.assert() | ||
.success() | ||
.stdout_matches(str![""]) | ||
.stderr_matches(file!["stderr.term.svg"]); | ||
} |
47 changes: 47 additions & 0 deletions
47
tests/testsuite/lints/unknown_lints/default/stderr.term.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
use cargo_test_support::prelude::*; | ||
use cargo_test_support::str; | ||
use cargo_test_support::{file, project}; | ||
|
||
#[cargo_test] | ||
fn case() { | ||
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(); | ||
|
||
snapbox::cmd::Command::cargo_ui() | ||
.masquerade_as_nightly_cargo(&["cargo-lints"]) | ||
.current_dir(p.root()) | ||
.arg("check") | ||
.arg("-Zcargo-lints") | ||
.assert() | ||
.success() | ||
.stdout_matches(str![""]) | ||
.stderr_matches(file!["stderr.term.svg"]); | ||
} |
Oops, something went wrong.