rust-lang/rust-clippy · error

using config file ` `, ` ` will be ignored

Error message

using config file `{}`, `{}` will be ignored

What it means

A warning, not a hard error: both .clippy.toml and clippy.toml exist in the same directory, and Clippy only loads one of them. load_conf_file iterates CONFIG_FILE_NAMES in order, so .clippy.toml wins and clippy.toml is silently skipped. The first placeholder is the loaded path and the second the ignored one. The mismatch usually comes from tooling or teammates generating differently-named config files.

Solutions

  1. Delete or rename the redundant config file so only one of .clippy.toml / clippy.toml remains
  2. Merge any settings from the ignored file into the loaded one before removing it
  3. Add a repo convention or lint check that rejects committing both filenames
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at clippy_config/src/conf.rs:895 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of rust-lang/rust-clippy@13aece1138 (2026-09-07). Data as JSON: /api/errors/63b7477b1c16a710. Report an issue: GitHub.

Appendix: source

Thrown at clippy_config/src/conf.rs:895

        .into_iter()
        .find_map(|(var, msg)| env::var_os(var).map(|p| (PathBuf::from(p), msg)))
        .unwrap_or_else(|| (PathBuf::from("."), "failed to get the current directory"));
    let mut current = match current.canonicalize() {
        Ok(x) => x,
        Err(e) => {
            sess.dcx().err(format!("{msg}: {e}"));
            return None;
        },
    };

    let mut loaded_config: Option<(PathBuf, Arc<SourceFile>)> = None;
    loop {
        for config_file_name in CONFIG_FILE_NAMES {
            if let Ok(config_path) = current.join(config_file_name).canonicalize() {
                if let Some((loaded_path, _)) = &loaded_config {
                    if fs::metadata(loaded_path).is_ok_and(|x| x.is_file()) {
                        // Warn if `.clippy.toml` and `clippy.toml` exist
                        sess.dcx().warn(format!(
                            "using config file `{}`, `{}` will be ignored",
                            loaded_path.display(),
                            config_path.display(),
                        ));
                    }
                } else {
                    match sess.source_map().load_file(&config_path) {
                        Ok(src) => loaded_config = Some((config_path, src)),
                        Err(e)
                            if matches!(
                                e.kind(),
                                io::ErrorKind::NotFound | io::ErrorKind::IsADirectory | io::ErrorKind::NotADirectory
                            ) => {},
                        Err(e) => {
                            sess.dcx()
                                .err(format!("error reading `{}`: {e}", config_path.display()));
                            return None;
                        },

View on GitHub (pinned to 13aece1138)