Skip to content

Commit 97d9608

Browse files
committed
Config::get_tool() now also accepts the configuration path in idiomatic kebab-case.
1 parent 94bf478 commit 97d9608

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/cargo/util/config/mod.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -873,9 +873,17 @@ impl Config {
873873
return Ok(Some(path));
874874
}
875875

876-
let var = format!("build.{}", tool);
877-
if let Some(tool_path) = self.get_path(&var)? {
878-
return Ok(Some(tool_path.val));
876+
// For backwards compatibility we allow both snake_case config paths as well as the
877+
// idiomatic kebab-case paths.
878+
let config_paths = [
879+
format!("build.{}", tool),
880+
format!("build.{}", tool.replace('_', "-")),
881+
];
882+
883+
for config_path in &config_paths {
884+
if let Some(tool_path) = self.get_path(&config_path)? {
885+
return Ok(Some(tool_path.val));
886+
}
879887
}
880888

881889
Ok(None)

0 commit comments

Comments
 (0)