@@ -548,24 +548,24 @@ pub mod rhai_rusp_deleteresp {
548548 . into_iter ( )
549549 . map ( |p| {
550550 p. try_cast :: < String > ( )
551- . ok_or ( "Expected to have an array of Strings" . into ( ) )
551+ . ok_or_else ( || "Expected to have an array of Strings" . into ( ) )
552552 } )
553553 . collect :: < Result < Vec < String > , Box < EvalAltResult > > > ( ) ?;
554554
555555 let unaffected_path_errs = unaffected_path_errs
556556 . into_iter ( )
557557 . map ( |p| {
558558 let el = p. try_cast :: < Array > ( )
559- . ok_or ( "Expected to have an array of arrays [param: &str, err_code: u32, err_msg: &str]" . to_string ( ) ) ?;
559+ . ok_or_else ( || "Expected to have an array of arrays [param: &str, err_code: u32, err_msg: &str]" . to_string ( ) ) ?;
560560 let el0 = el. first ( )
561561 . and_then ( |el| el. clone ( ) . try_cast :: < String > ( ) )
562- . ok_or ( "param (#1) needs to be a string" . to_string ( ) ) ?;
562+ . ok_or_else ( || "param (#1) needs to be a string" . to_string ( ) ) ?;
563563 let el1 = el. get ( 1 )
564564 . and_then ( |el| el. clone ( ) . try_cast :: < i64 > ( ) )
565- . ok_or ( "err_code (#2) needs to be a u32" . to_string ( ) ) ?;
565+ . ok_or_else ( || "err_code (#2) needs to be a u32" . to_string ( ) ) ?;
566566 let el2 = el. get ( 2 )
567567 . and_then ( |el| el. clone ( ) . try_cast :: < String > ( ) )
568- . ok_or ( "err_msg (#3) needs to be a string" . to_string ( ) ) ?;
568+ . ok_or_else ( || "err_msg (#3) needs to be a string" . to_string ( ) ) ?;
569569
570570 Ok ( DeleteRespUnaffectedPathError { unaffected_path : el0, err_code : u32:: try_from ( el1) . unwrap_or ( 7003 ) , err_msg : el2 } )
571571 } )
@@ -747,7 +747,10 @@ pub mod rhai_rusp_register {
747747
748748 #[ rhai_fn( global) ]
749749 #[ must_use]
750- pub const fn with_allow_partial ( builder : RegisterBuilder , allow_partial : bool ) -> RegisterBuilder {
750+ pub const fn with_allow_partial (
751+ builder : RegisterBuilder ,
752+ allow_partial : bool ,
753+ ) -> RegisterBuilder {
751754 builder. with_allow_partial ( allow_partial)
752755 }
753756
@@ -916,16 +919,16 @@ pub mod rhai_rusp_set {
916919 . into_iter ( )
917920 . map ( |p| {
918921 let el = p. try_cast :: < Array > ( )
919- . ok_or ( "Expected to have an array of arrays [param: &str, value: &str, required: bool]" . to_string ( ) ) ?;
922+ . ok_or_else ( || "Expected to have an array of arrays [param: &str, value: &str, required: bool]" . to_string ( ) ) ?;
920923 let el0 = el. first ( )
921924 . and_then ( |el| el. clone ( ) . try_cast :: < String > ( ) )
922- . ok_or ( "param (#1) needs to be a string" . to_string ( ) ) ?;
925+ . ok_or_else ( || "param (#1) needs to be a string" . to_string ( ) ) ?;
923926 let el1 = el. get ( 1 )
924927 . and_then ( |el| el. clone ( ) . try_cast :: < String > ( ) )
925- . ok_or ( "value (#2) needs to be a string" . to_string ( ) ) ?;
928+ . ok_or_else ( || "value (#2) needs to be a string" . to_string ( ) ) ?;
926929 let el2 = el. get ( 2 )
927930 . and_then ( |el| el. clone ( ) . try_cast :: < bool > ( ) )
928- . ok_or ( "required (#3) needs to be a bool" . to_string ( ) ) ?;
931+ . ok_or_else ( || "required (#3) needs to be a bool" . to_string ( ) ) ?;
929932
930933 Ok ( ( el0, el1, el2) )
931934 } )
@@ -1015,16 +1018,16 @@ pub mod rhai_rusp_setresp {
10151018 . into_iter ( )
10161019 . map ( |p| {
10171020 let el = p. try_cast :: < Array > ( )
1018- . ok_or ( "Expected to have an array of arrays [param: &str, err_code: u32, err_msg: &str]" . to_string ( ) ) ?;
1021+ . ok_or_else ( || "Expected to have an array of arrays [param: &str, err_code: u32, err_msg: &str]" . to_string ( ) ) ?;
10191022 let el0 = el. first ( )
10201023 . and_then ( |el| el. clone ( ) . try_cast :: < String > ( ) )
1021- . ok_or ( "param (#1) needs to be a string" . to_string ( ) ) ?;
1024+ . ok_or_else ( || "param (#1) needs to be a string" . to_string ( ) ) ?;
10221025 let el1 = el. get ( 1 )
10231026 . and_then ( |el| el. clone ( ) . try_cast :: < i64 > ( ) )
1024- . ok_or ( "err_code (#2) needs to be a u32" . to_string ( ) ) ?;
1027+ . ok_or_else ( || "err_code (#2) needs to be a u32" . to_string ( ) ) ?;
10251028 let el2 = el. get ( 2 )
10261029 . and_then ( |el| el. clone ( ) . try_cast :: < String > ( ) )
1027- . ok_or ( "err_msg (#3) needs to be a string" . to_string ( ) ) ?;
1030+ . ok_or_else ( || "err_msg (#3) needs to be a string" . to_string ( ) ) ?;
10281031
10291032 Ok ( SetRespParameterError :: new ( el0, u32:: try_from ( el1) . unwrap_or ( 7003 ) , Some ( el2) ) )
10301033 } )
@@ -1066,16 +1069,16 @@ pub mod rhai_rusp_setresp {
10661069 . into_iter ( )
10671070 . map ( |p| {
10681071 let el = p. try_cast :: < Array > ( )
1069- . ok_or ( "Expected to have an array of arrays [param: &str, err_code: u32, err_msg: &str]" . to_string ( ) ) ?;
1072+ . ok_or_else ( || "Expected to have an array of arrays [param: &str, err_code: u32, err_msg: &str]" . to_string ( ) ) ?;
10701073 let el0 = el. first ( )
10711074 . and_then ( |el| el. clone ( ) . try_cast :: < String > ( ) )
1072- . ok_or ( "param (#1) needs to be a string" . to_string ( ) ) ?;
1075+ . ok_or_else ( || "param (#1) needs to be a string" . to_string ( ) ) ?;
10731076 let el1 = el. get ( 1 )
10741077 . and_then ( |el| el. clone ( ) . try_cast :: < i64 > ( ) )
1075- . ok_or ( "err_code (#2) needs to be a u32" . to_string ( ) ) ?;
1078+ . ok_or_else ( || "err_code (#2) needs to be a u32" . to_string ( ) ) ?;
10761079 let el2 = el. get ( 2 )
10771080 . and_then ( |el| el. clone ( ) . try_cast :: < String > ( ) )
1078- . ok_or ( "err_msg (#3) needs to be a string" . to_string ( ) ) ?;
1081+ . ok_or_else ( || "err_msg (#3) needs to be a string" . to_string ( ) ) ?;
10791082
10801083 Ok ( SetRespParameterError :: new ( el0, u32:: try_from ( el1) . unwrap_or ( 7003 ) , Some ( el2) ) )
10811084 } )
@@ -1158,16 +1161,16 @@ pub mod rhai_rusp_error {
11581161 . into_iter ( )
11591162 . map ( |p| {
11601163 let el = p. try_cast :: < Array > ( )
1161- . ok_or ( "Expected to have an array of arrays [param: &str, err_code: u32, err_msg: &str]" . to_string ( ) ) ?;
1164+ . ok_or_else ( || "Expected to have an array of arrays [param: &str, err_code: u32, err_msg: &str]" . to_string ( ) ) ?;
11621165 let el0 = el. first ( )
11631166 . and_then ( |el| el. clone ( ) . try_cast :: < String > ( ) )
1164- . ok_or ( "param (#1) needs to be a string" . to_string ( ) ) ?;
1167+ . ok_or_else ( || "param (#1) needs to be a string" . to_string ( ) ) ?;
11651168 let el1 = el. get ( 1 )
11661169 . and_then ( |el| el. clone ( ) . try_cast :: < i64 > ( ) )
1167- . ok_or ( "err_code (#2) needs to be a u32" . to_string ( ) ) ?;
1170+ . ok_or_else ( || "err_code (#2) needs to be a u32" . to_string ( ) ) ?;
11681171 let el2 = el. get ( 2 )
11691172 . and_then ( |el| el. clone ( ) . try_cast :: < String > ( ) )
1170- . ok_or ( "err_msg (#3) needs to be a string" . to_string ( ) ) ?;
1173+ . ok_or_else ( || "err_msg (#3) needs to be a string" . to_string ( ) ) ?;
11711174
11721175 Ok ( ( el0, u32:: try_from ( el1) . unwrap_or ( 7003 ) , el2) )
11731176 } )
@@ -1649,12 +1652,12 @@ pub mod rhai_rusp_getsupporteddmresp {
16491652 . into_iter ( )
16501653 . map ( |p| {
16511654 p. try_cast :: < Array > ( )
1652- . ok_or ( "Expected to have an array of arrays of string" . to_string ( ) ) ?
1655+ . ok_or_else ( || "Expected to have an array of arrays of string" . to_string ( ) ) ?
16531656 . iter ( )
16541657 . map ( |el| {
16551658 el. clone ( )
16561659 . try_cast :: < String > ( )
1657- . ok_or ( "param needs to be a string" . to_string ( ) )
1660+ . ok_or_else ( || "param needs to be a string" . to_string ( ) )
16581661 } )
16591662 . collect :: < Result < Vec < String > , _ > > ( )
16601663 } )
@@ -2100,16 +2103,16 @@ pub mod rhai_rusp_add {
21002103 . into_iter ( )
21012104 . map ( |p| {
21022105 let el = p. try_cast :: < Array > ( )
2103- . ok_or ( "Expected to have an array of arrays [param: &str, value: &str, required: bool]" . to_string ( ) ) ?;
2106+ . ok_or_else ( || "Expected to have an array of arrays [param: &str, value: &str, required: bool]" . to_string ( ) ) ?;
21042107 let el0 = el. first ( )
21052108 . and_then ( |el| el. clone ( ) . try_cast :: < String > ( ) )
2106- . ok_or ( "param (#1) needs to be a string" . to_string ( ) ) ?;
2109+ . ok_or_else ( || "param (#1) needs to be a string" . to_string ( ) ) ?;
21072110 let el1 = el. get ( 1 )
21082111 . and_then ( |el| el. clone ( ) . try_cast :: < String > ( ) )
2109- . ok_or ( "value (#2) needs to be a string" . to_string ( ) ) ?;
2112+ . ok_or_else ( || "value (#2) needs to be a string" . to_string ( ) ) ?;
21102113 let el2 = el. get ( 2 )
21112114 . and_then ( |el| el. clone ( ) . try_cast :: < bool > ( ) )
2112- . ok_or ( "required (#3) needs to be a bool" . to_string ( ) ) ?;
2115+ . ok_or_else ( || "required (#3) needs to be a bool" . to_string ( ) ) ?;
21132116
21142117 Ok ( ( el0, el1, el2) )
21152118 } )
@@ -2204,16 +2207,16 @@ pub mod rhai_rusp_addresp {
22042207 . into_iter ( )
22052208 . map ( |p| {
22062209 let el = p. try_cast :: < Array > ( )
2207- . ok_or ( "Expected to have an array of arrays [param: &str, err_code: u32, err_msg: &str]" . to_string ( ) ) ?;
2210+ . ok_or_else ( || "Expected to have an array of arrays [param: &str, err_code: u32, err_msg: &str]" . to_string ( ) ) ?;
22082211 let el0 = el. first ( )
22092212 . and_then ( |el| el. clone ( ) . try_cast :: < String > ( ) )
2210- . ok_or ( "param (#1) needs to be a string" . to_string ( ) ) ?;
2213+ . ok_or_else ( || "param (#1) needs to be a string" . to_string ( ) ) ?;
22112214 let el1 = el. get ( 1 )
22122215 . and_then ( |el| el. clone ( ) . try_cast :: < i64 > ( ) )
2213- . ok_or ( "err_code (#2) needs to be a u32" . to_string ( ) ) ?;
2216+ . ok_or_else ( || "err_code (#2) needs to be a u32" . to_string ( ) ) ?;
22142217 let el2 = el. get ( 2 )
22152218 . and_then ( |el| el. clone ( ) . try_cast :: < String > ( ) )
2216- . ok_or ( "err_msg (#3) needs to be a string" . to_string ( ) ) ?;
2219+ . ok_or_else ( || "err_msg (#3) needs to be a string" . to_string ( ) ) ?;
22172220
22182221 Ok ( AddRespParameterError { param : el0, err_code : u32:: try_from ( el1) . unwrap_or ( 7003 ) , err_msg : el2 } )
22192222 } )
0 commit comments