Change env var used for testing Clippy

This changes the variable used for testing Clippy in the internal test
suite:

```
CLIPPY_TESTS -> __CLIPPY_INTERNAL_TESTS
```

`CLIPPY_TESTS` is understandably used in environments of Clippy users,
so we shouldn't use it in our test suite.
This commit is contained in:
flip1995 2021-01-07 12:38:10 +01:00
parent 8e5c5a64a5
commit 547ce0db27
No known key found for this signature in database
GPG key ID: 1CA0DF2AF59D68A5
3 changed files with 9 additions and 5 deletions

View file

@ -147,10 +147,14 @@ add `// edition:2018` at the top of the test file (note that it's space-sensitiv
Manually testing against an example file can be useful if you have added some
`println!`s and the test suite output becomes unreadable. To try Clippy with
your local modifications, run `env CLIPPY_TESTS=true cargo run --bin
clippy-driver -- -L ./target/debug input.rs` from the working copy root.
your local modifications, run
With tests in place, let's have a look at implementing our lint now.
```
env __CLIPPY_INTERNAL_TESTS=true cargo run --bin clippy-driver -- -L ./target/debug input.rs
```
from the working copy root. With tests in place, let's have a look at
implementing our lint now.
## Lint declaration

View file

@ -298,7 +298,7 @@ pub fn main() {
// - IF Clippy is run on the main crate, not on deps (`!cap_lints_allow`) THEN
// - IF `--no-deps` is not set (`!no_deps`) OR
// - IF `--no-deps` is set and Clippy is run on the specified primary package
let clippy_tests_set = env::var("CLIPPY_TESTS").map_or(false, |val| val == "true");
let clippy_tests_set = env::var("__CLIPPY_INTERNAL_TESTS").map_or(false, |val| val == "true");
let cap_lints_allow = arg_value(&orig_args, "--cap-lints", |val| val == "allow").is_some();
let in_primary_package = env::var("CARGO_PRIMARY_PACKAGE").is_ok();

View file

@ -254,7 +254,7 @@ fn run_ui_cargo(config: &mut compiletest::Config) {
fn prepare_env() {
set_var("CLIPPY_DISABLE_DOCS_LINKS", "true");
set_var("CLIPPY_TESTS", "true");
set_var("__CLIPPY_INTERNAL_TESTS", "true");
//set_var("RUST_BACKTRACE", "0");
}