@@ -37,7 +37,7 @@ pub fn as_bytes(input: &RadonString, args: &Option<Vec<Value>>) -> Result<RadonB
37
37
let wrong_args = || RadError :: WrongArguments {
38
38
input_type : RadonString :: radon_type_name ( ) ,
39
39
operator : "AsBytes" . to_string ( ) ,
40
- args : args. to_owned ( ) . unwrap_or ( Vec :: < Value > :: default ( ) ) . to_vec ( ) ,
40
+ args : args. to_owned ( ) . unwrap_or_default ( ) . to_vec ( ) ,
41
41
} ;
42
42
let mut input_string = input. value ( ) ;
43
43
if input_string. starts_with ( "0x" ) {
@@ -49,7 +49,7 @@ pub fn as_bytes(input: &RadonString, args: &Option<Vec<Value>>) -> Result<RadonB
49
49
let mut bytes_encoding = RadonBytesEncoding :: Hex ;
50
50
match args {
51
51
Some ( args) => {
52
- if args. len ( ) > 0 {
52
+ if ! args. is_empty ( ) {
53
53
let arg = args. first ( ) . ok_or_else ( wrong_args) ?. to_owned ( ) ;
54
54
let bytes_encoding_u8 = from_value :: < u8 > ( arg) . map_err ( |_| wrong_args ( ) ) ?;
55
55
bytes_encoding = RadonBytesEncoding :: try_from ( bytes_encoding_u8) . map_err ( |_| wrong_args ( ) ) ?;
@@ -203,7 +203,7 @@ pub fn parse_json_array(input: &RadonString, args: &Option<Vec<Value>>) -> Resul
203
203
description : err. to_string ( ) ,
204
204
} ) ?;
205
205
let mut subitems: Vec < RadonTypes > = selector. find ( & json_input)
206
- . map ( |item| into_radon_types ( item ) )
206
+ . map ( into_radon_types)
207
207
. collect ( ) ;
208
208
if subitems. len ( ) > 1 {
209
209
items. insert ( items. len ( ) , RadonArray :: from ( subitems) . into ( ) ) ;
@@ -222,7 +222,7 @@ pub fn parse_json_array(input: &RadonString, args: &Option<Vec<Value>>) -> Resul
222
222
description : err. to_string ( ) ,
223
223
} ) ?;
224
224
let items: Vec < RadonTypes > = selector. find ( & json_input)
225
- . map ( |item| into_radon_types ( item ) )
225
+ . map ( into_radon_types)
226
226
. collect ( ) ;
227
227
Ok ( RadonArray :: from ( items) )
228
228
}
@@ -254,7 +254,7 @@ fn into_radon_types(value: &serde_json::Value) -> RadonTypes {
254
254
serde_json:: Value :: Array ( values) => {
255
255
let items: Vec < RadonTypes > = values
256
256
. iter ( )
257
- . map ( |item| into_radon_types ( item ) )
257
+ . map ( into_radon_types)
258
258
. collect ( ) ;
259
259
RadonTypes :: from ( RadonArray :: from ( items) )
260
260
}
0 commit comments