mirror of
https://github.com/Horizontal42/summarum.git
synced 2026-11-11 01:02:01 +03:00
Fix clippy::collapsible_match warning in safe_name
Co-authored-by: Horizontal42 <75383519+Horizontal42@users.noreply.github.com>
This commit is contained in:
parent
e183f58af1
commit
6ac39d828e
1 changed files with 2 additions and 6 deletions
|
|
@ -38,12 +38,8 @@ fn safe_name(name: &str) -> bool {
|
||||||
let path = Path::new(name);
|
let path = Path::new(name);
|
||||||
let mut components = path.components();
|
let mut components = path.components();
|
||||||
match components.next() {
|
match components.next() {
|
||||||
Some(std::path::Component::Normal(_)) => {
|
Some(std::path::Component::Normal(_)) if components.next().is_none() => {
|
||||||
if components.next().is_none() {
|
!name.contains(['/', '\\', ':'])
|
||||||
!name.contains(['/', '\\', ':'])
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue