Use map_or where possible

This commit is contained in:
p11 2024-09-19 14:23:57 +02:00
parent e4d292ae58
commit 27d112fc59
2 changed files with 2 additions and 4 deletions

View File

@ -528,8 +528,7 @@ fn handle_relative_connection(
let title = relative_path
.rsplit_once('/')
.map(|(_, title)| title)
.unwrap_or(relative_path);
.map_or(relative_path, |(_, title)| title);
let handle_entry = |mut entry: &str, output: &mut TcpStream, level: usize| {
let level = level + 1;

View File

@ -28,8 +28,7 @@ impl Request {
let version = if let Some(version) = initial_line.next() {
version
.split_once('/')
.map(|(_, version)| version)
.unwrap_or("1.1")
.map_or("1.1", |(_, version)| version)
} else {
"1.1"
}