chore: prefer AsRef<Path> to &Path (#8249)

This is some minor API cleanup that will make it easier to use
`AbsolutePathBuf` in more places in a subsequent PR.
This commit is contained in:
Michael Bolin
2025-12-18 08:50:13 -08:00
committed by GitHub
parent 374d591311
commit deafead169
3 changed files with 14 additions and 14 deletions

View File

@@ -470,15 +470,15 @@ fn validate_config(value: &TomlValue) -> Result<(), toml::de::Error> {
Ok(())
}
fn paths_match(expected: &Path, provided: &Path) -> bool {
fn paths_match(expected: impl AsRef<Path>, provided: impl AsRef<Path>) -> bool {
if let (Ok(expanded_expected), Ok(expanded_provided)) = (
path_utils::normalize_for_path_comparison(expected),
path_utils::normalize_for_path_comparison(provided),
path_utils::normalize_for_path_comparison(&expected),
path_utils::normalize_for_path_comparison(&provided),
) {
return expanded_expected == expanded_provided;
expanded_expected == expanded_provided
} else {
expected.as_ref() == provided.as_ref()
}
expected == provided
}
fn value_at_path<'a>(root: &'a TomlValue, segments: &[String]) -> Option<&'a TomlValue> {