Use &impl AsRef<Path> instead of type parameter (#4383)

This commit is contained in:
Zanie Blue 2024-06-18 11:54:07 -04:00 committed by GitHub
parent 0b0a0472ad
commit b3e3d899e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 4 deletions

View file

@ -289,9 +289,9 @@ mod tests {
} }
/// Create child directories in a temporary directory. /// Create child directories in a temporary directory.
fn new_search_path_directories<P: AsRef<Path>>( fn new_search_path_directories(
&mut self, &mut self,
names: &[P], names: &[impl AsRef<Path>],
) -> Result<Vec<ChildPath>> { ) -> Result<Vec<ChildPath>> {
let paths = names let paths = names
.iter() .iter()

View file

@ -67,7 +67,7 @@ impl Shell {
/// assert_eq!(Shell::from_shell_path("/usr/bin/zsh"), Some(Shell::Zsh)); /// assert_eq!(Shell::from_shell_path("/usr/bin/zsh"), Some(Shell::Zsh));
/// assert_eq!(Shell::from_shell_path("/opt/my_custom_shell"), None); /// assert_eq!(Shell::from_shell_path("/opt/my_custom_shell"), None);
/// ``` /// ```
pub(crate) fn from_shell_path<P: AsRef<Path>>(path: P) -> Option<Shell> { pub(crate) fn from_shell_path(path: impl AsRef<Path>) -> Option<Shell> {
parse_shell_from_path(path.as_ref()) parse_shell_from_path(path.as_ref())
} }
} }

View file

@ -582,7 +582,7 @@ pub fn site_packages_path(venv: &Path, python: &str) -> PathBuf {
} }
} }
pub fn venv_bin_path<P: AsRef<Path>>(venv: &P) -> PathBuf { pub fn venv_bin_path(venv: impl AsRef<Path>) -> PathBuf {
if cfg!(unix) { if cfg!(unix) {
venv.as_ref().join("bin") venv.as_ref().join("bin")
} else if cfg!(windows) { } else if cfg!(windows) {