Explain which paths clippy searches for configuration in docs
This commit is contained in:
parent
652b4c720d
commit
5f5e2e2ac1
@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
> **Note:** The configuration file is unstable and may be deprecated in the future.
|
> **Note:** The configuration file is unstable and may be deprecated in the future.
|
||||||
|
|
||||||
Some lints can be configured in a TOML file named `clippy.toml` or `.clippy.toml`. It contains a
|
Some lints can be configured in a TOML file named `clippy.toml` or `.clippy.toml`, placed in a directory specified by
|
||||||
basic `variable = value` mapping e.g.
|
the environment variable `CLIPPY_CONF_DIR`, or if that's not found, the environment variable
|
||||||
|
[CARGO_MANIFEST_DIR](https://doc.rust-lang.org/cargo/reference/environment-variables.html), or if that isn't
|
||||||
|
found, the current directory. It contains a basic `variable = value` mapping e.g.
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
avoid-breaking-exported-api = false
|
avoid-breaking-exported-api = false
|
||||||
|
@ -630,8 +630,10 @@ Before submitting your PR make sure you followed all the basic requirements:
|
|||||||
|
|
||||||
## Adding configuration to a lint
|
## Adding configuration to a lint
|
||||||
|
|
||||||
Clippy supports the configuration of lints values using a `clippy.toml` file in
|
Clippy supports the configuration of lints values using a `clippy.toml` file in a directory specified by
|
||||||
the workspace directory. Adding a configuration to a lint can be useful for
|
the environment variable `CLIPPY_CONF_DIR`, or if that's not found, the environment variable
|
||||||
|
[CARGO_MANIFEST_DIR](https://doc.rust-lang.org/cargo/reference/environment-variables.html), or if that isn't
|
||||||
|
found, the current directory. Adding a configuration to a lint can be useful for
|
||||||
thresholds or to constrain some behavior that can be seen as a false positive
|
thresholds or to constrain some behavior that can be seen as a false positive
|
||||||
for some users. Adding a configuration is done in the following steps:
|
for some users. Adding a configuration is done in the following steps:
|
||||||
|
|
||||||
|
@ -486,7 +486,7 @@ pub fn lookup_conf_file() -> io::Result<(Option<PathBuf>, Vec<String>)> {
|
|||||||
const CONFIG_FILE_NAMES: [&str; 2] = [".clippy.toml", "clippy.toml"];
|
const CONFIG_FILE_NAMES: [&str; 2] = [".clippy.toml", "clippy.toml"];
|
||||||
|
|
||||||
// Start looking for a config file in CLIPPY_CONF_DIR, or failing that, CARGO_MANIFEST_DIR.
|
// Start looking for a config file in CLIPPY_CONF_DIR, or failing that, CARGO_MANIFEST_DIR.
|
||||||
// If neither of those exist, use ".".
|
// If neither of those exist, use ".". (Update documentation if this priority changes)
|
||||||
let mut current = env::var_os("CLIPPY_CONF_DIR")
|
let mut current = env::var_os("CLIPPY_CONF_DIR")
|
||||||
.or_else(|| env::var_os("CARGO_MANIFEST_DIR"))
|
.or_else(|| env::var_os("CARGO_MANIFEST_DIR"))
|
||||||
.map_or_else(|| PathBuf::from("."), PathBuf::from)
|
.map_or_else(|| PathBuf::from("."), PathBuf::from)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user