multiple configs: add tests
This commit is contained in:
parent
97e5a70f47
commit
1193abe4c8
@ -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(),
|
||||
);
|
||||
|
8
tests/ui-cargo/multiple_config_files/no_warn/Cargo.toml
Normal file
8
tests/ui-cargo/multiple_config_files/no_warn/Cargo.toml
Normal file
@ -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
tests/ui-cargo/multiple_config_files/no_warn/clippy.toml
Normal file
1
tests/ui-cargo/multiple_config_files/no_warn/clippy.toml
Normal file
@ -0,0 +1 @@
|
||||
avoid-breaking-exported-api = false
|
3
tests/ui-cargo/multiple_config_files/no_warn/src/main.rs
Normal file
3
tests/ui-cargo/multiple_config_files/no_warn/src/main.rs
Normal file
@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
1
tests/ui-cargo/multiple_config_files/warn/.clippy.toml
Normal file
1
tests/ui-cargo/multiple_config_files/warn/.clippy.toml
Normal file
@ -0,0 +1 @@
|
||||
avoid-breaking-exported-api = false
|
8
tests/ui-cargo/multiple_config_files/warn/Cargo.toml
Normal file
8
tests/ui-cargo/multiple_config_files/warn/Cargo.toml
Normal file
@ -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
tests/ui-cargo/multiple_config_files/warn/clippy.toml
Normal file
1
tests/ui-cargo/multiple_config_files/warn/clippy.toml
Normal file
@ -0,0 +1 @@
|
||||
avoid-breaking-exported-api = false
|
3
tests/ui-cargo/multiple_config_files/warn/src/main.rs
Normal file
3
tests/ui-cargo/multiple_config_files/warn/src/main.rs
Normal file
@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
@ -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.
|
Loading…
x
Reference in New Issue
Block a user