Skip to content

Commit 5f5e2e2

Browse files
committed
Explain which paths clippy searches for configuration in docs
1 parent 652b4c7 commit 5f5e2e2

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

book/src/configuration.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
> **Note:** The configuration file is unstable and may be deprecated in the future.
44
5-
Some lints can be configured in a TOML file named `clippy.toml` or `.clippy.toml`. It contains a
6-
basic `variable = value` mapping e.g.
5+
Some lints can be configured in a TOML file named `clippy.toml` or `.clippy.toml`, placed in a directory specified by
6+
the environment variable `CLIPPY_CONF_DIR`, or if that's not found, the environment variable
7+
[CARGO_MANIFEST_DIR](https://doc.rust-lang.org/cargo/reference/environment-variables.html), or if that isn't
8+
found, the current directory. It contains a basic `variable = value` mapping e.g.
79

810
```toml
911
avoid-breaking-exported-api = false

book/src/development/adding_lints.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,8 +630,10 @@ Before submitting your PR make sure you followed all the basic requirements:
630630

631631
## Adding configuration to a lint
632632

633-
Clippy supports the configuration of lints values using a `clippy.toml` file in
634-
the workspace directory. Adding a configuration to a lint can be useful for
633+
Clippy supports the configuration of lints values using a `clippy.toml` file in a directory specified by
634+
the environment variable `CLIPPY_CONF_DIR`, or if that's not found, the environment variable
635+
[CARGO_MANIFEST_DIR](https://doc.rust-lang.org/cargo/reference/environment-variables.html), or if that isn't
636+
found, the current directory. Adding a configuration to a lint can be useful for
635637
thresholds or to constrain some behavior that can be seen as a false positive
636638
for some users. Adding a configuration is done in the following steps:
637639

clippy_lints/src/utils/conf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ pub fn lookup_conf_file() -> io::Result<(Option<PathBuf>, Vec<String>)> {
486486
const CONFIG_FILE_NAMES: [&str; 2] = [".clippy.toml", "clippy.toml"];
487487

488488
// Start looking for a config file in CLIPPY_CONF_DIR, or failing that, CARGO_MANIFEST_DIR.
489-
// If neither of those exist, use ".".
489+
// If neither of those exist, use ".". (Update documentation if this priority changes)
490490
let mut current = env::var_os("CLIPPY_CONF_DIR")
491491
.or_else(|| env::var_os("CARGO_MANIFEST_DIR"))
492492
.map_or_else(|| PathBuf::from("."), PathBuf::from)

0 commit comments

Comments
 (0)