diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2021-02-13 00:39:19 +0100 |
|---|---|---|
| committer | Matthias Krüger <matthias.krueger@famsik.de> | 2021-02-13 00:39:19 +0100 |
| commit | 5bbb1bc20a24ad64ab7a70d002ee95c5ce9d6f8a (patch) | |
| tree | f8fa69f4fcdfdd24b4964d5ff57813cdbb5fdc20 | |
| parent | 047f3e16bfc158717c6aeaa152a31eb42f3b9f04 (diff) | |
| download | rust-5bbb1bc20a24ad64ab7a70d002ee95c5ce9d6f8a.tar.gz rust-5bbb1bc20a24ad64ab7a70d002ee95c5ce9d6f8a.zip | |
lintcheck: env var LINTCHECK_TOML can be used to override toml file location (has precedence over --crates-toml flag)
| -rw-r--r-- | clippy_dev/README.md | 2 | ||||
| -rw-r--r-- | clippy_dev/src/lintcheck.rs | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/clippy_dev/README.md b/clippy_dev/README.md index 3846e8bd4cc..a09365fadc4 100644 --- a/clippy_dev/README.md +++ b/clippy_dev/README.md @@ -21,7 +21,7 @@ cargo dev-lintcheck By default the logs will be saved into `lintcheck-logs/lintcheck_crates_logs.txt`. -You can set a custom sources.toml by adding `--crates-toml custom.toml` +You can set a custom sources.toml by adding `--crates-toml custom.toml` or using `LINTCHECK_TOML="custom.toml"` where `custom.toml` must be a relative path from the repo root. The results will then be saved to `lintcheck-logs/custom_logs.toml`. diff --git a/clippy_dev/src/lintcheck.rs b/clippy_dev/src/lintcheck.rs index 749a791b280..3836df39adc 100644 --- a/clippy_dev/src/lintcheck.rs +++ b/clippy_dev/src/lintcheck.rs @@ -11,7 +11,7 @@ use crate::clippy_project_root; use std::collections::HashMap; use std::process::Command; -use std::{fmt, fs::write, path::PathBuf}; +use std::{env, fmt, fs::write, path::PathBuf}; use clap::ArgMatches; use serde::{Deserialize, Serialize}; @@ -227,7 +227,9 @@ fn build_clippy() { // get a list of CrateSources we want to check from a "lintcheck_crates.toml" file. fn read_crates(toml_path: Option<&str>) -> (String, Vec<CrateSource>) { - let toml_path = PathBuf::from(toml_path.unwrap_or("clippy_dev/lintcheck_crates.toml")); + let toml_path = PathBuf::from( + env::var("LINTCHECK_TOML").unwrap_or(toml_path.unwrap_or("clippy_dev/lintcheck_crates.toml").to_string()), + ); // save it so that we can use the name of the sources.toml as name for the logfile later. let toml_filename = toml_path.file_stem().unwrap().to_str().unwrap().to_string(); let toml_content: String = |
