From 7b84948624527a31d4338481514bbb53ee1f5a31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E8=BF=90=E5=AE=B6?= Date: Sat, 2 Nov 2024 11:58:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81=EF=BC=8C?= =?UTF-8?q?=E9=81=BF=E5=85=8D=E4=BD=BF=E7=94=A8clone=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E9=A2=9D=E5=A4=96=E7=9A=84=E5=86=85=E5=AD=98=E5=8D=A0=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/src/model/validator.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library/src/model/validator.rs b/library/src/model/validator.rs index 76a74a3..ce3fd87 100644 --- a/library/src/model/validator.rs +++ b/library/src/model/validator.rs @@ -24,8 +24,8 @@ pub fn validate_params(params: &impl Validate, local: &str) -> ResResult { err.iter().for_each(|e| { - let msg = e.message.clone().unwrap_or_default(); - errors.push(message!(local, MessageId::from_str(msg.trim()).unwrap())) + let msg = e.message.as_ref().unwrap(); + errors.push(message!(local, MessageId::from_str(msg).unwrap())) }); }, }; @@ -38,8 +38,8 @@ pub fn validate_params(params: &impl Validate, local: &str) -> ResResult, raw_errors: &Box, local: &str) { for (_field, errs) in raw_errors.field_errors() { for e in errs { - let msg = e.message.clone().unwrap_or_default(); - errors.push(message!(local, MessageId::from_str(msg.trim()).unwrap())); + let msg = e.message.as_ref().unwrap(); + errors.push(message!(local, MessageId::from_str(msg).unwrap())); } } } \ No newline at end of file