From 3c202d7afa07841176cd61900cfafe7dd77ca8bb Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Thu, 17 Mar 2022 18:15:29 +0100 Subject: [PATCH] Improve code readability --- src/server.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server.rs b/src/server.rs index 089fa03..e92249f 100644 --- a/src/server.rs +++ b/src/server.rs @@ -159,8 +159,8 @@ impl FromRequest for CustomRequest { let mut field = el?; let content_type = field.content_disposition().clone(); - let name = content_type.get_name().ok_or( - ErrorInternalServerError("Missing field name!"))?; + let name = content_type.get_name(). + ok_or_else(|| ErrorInternalServerError("Missing field name!"))?; // Handle file upload if content_type.get_filename().is_some() {