Skip to content

Commit

Permalink
multiple configs: add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiaskrgr committed Jan 31, 2022
1 parent 97e5a70 commit 1193abe
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 2 deletions.
4 changes: 2 additions & 2 deletions clippy_lints/src/utils/conf.rs
Expand Up @@ -333,10 +333,10 @@ pub fn lookup_conf_file() -> io::Result<Option<PathBuf>> {
Err(e) => return Err(e),
Ok(md) if md.is_dir() => {},
Ok(_) => {
// warn if we happen to find two config files
// warn if we happen to find two config files #8323
if let Some(ref found_config_) = found_config {
eprintln!(
"Warning: found two config files: {} and {}.\nUsing the first one!",
"Using config file `{}`\nWarning: `{}` will be ignored.",
found_config_.display(),
config_file.display(),
);
Expand Down
8 changes: 8 additions & 0 deletions tests/ui-cargo/multiple_config_files/no_warn/Cargo.toml
@@ -0,0 +1,8 @@
[package]
name = "no_warn"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
1 change: 1 addition & 0 deletions tests/ui-cargo/multiple_config_files/no_warn/clippy.toml
@@ -0,0 +1 @@
avoid-breaking-exported-api = false
3 changes: 3 additions & 0 deletions tests/ui-cargo/multiple_config_files/no_warn/src/main.rs
@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}
1 change: 1 addition & 0 deletions tests/ui-cargo/multiple_config_files/warn/.clippy.toml
@@ -0,0 +1 @@
avoid-breaking-exported-api = false
8 changes: 8 additions & 0 deletions tests/ui-cargo/multiple_config_files/warn/Cargo.toml
@@ -0,0 +1,8 @@
[package]
name = "warn"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
1 change: 1 addition & 0 deletions tests/ui-cargo/multiple_config_files/warn/clippy.toml
@@ -0,0 +1 @@
avoid-breaking-exported-api = false
3 changes: 3 additions & 0 deletions tests/ui-cargo/multiple_config_files/warn/src/main.rs
@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}
2 changes: 2 additions & 0 deletions tests/ui-cargo/multiple_config_files/warn/src/main.stderr
@@ -0,0 +1,2 @@
Using config file `$SRC_DIR/tests/ui-cargo/multiple_config_files/warn/.clippy.toml`
Warning: `$SRC_DIR/tests/ui-cargo/multiple_config_files/warn/clippy.toml` will be ignored.

0 comments on commit 1193abe

Please sign in to comment.