Cargo clippy to simplify

This commit is contained in:
Zhenping Zhao
2024-11-23 14:31:34 -08:00
parent a7c9695944
commit 0e79714483

View File

@ -153,11 +153,9 @@ pub mod _impl {
/// Extract the drive letter from a path (e.g., `C:test` -> `C`)
fn extract_drive_letter(path: &Path) -> Option<char> {
Some(
path.to_str()
path.to_str()
.and_then(|s| s.chars().next())
.filter(|c| c.is_ascii_alphabetic())?,
)
.filter(|c| c.is_ascii_alphabetic())
}
/// Ensure a path has a trailing `\`