File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -32,15 +32,15 @@ where
32
32
D : Deserializer < ' de > ,
33
33
{
34
34
let channel_id = String :: deserialize ( deserializer) ?;
35
- let channel_id = validate_channel_id ( channel_id) . map_err ( serde:: de:: Error :: custom) ?;
35
+ let channel_id = validate_channel_id ( & channel_id) . map_err ( serde:: de:: Error :: custom) ?;
36
36
<[ u8 ; 32 ] as FromHex >:: from_hex ( channel_id) . map_err ( serde:: de:: Error :: custom)
37
37
}
38
38
39
- fn validate_channel_id ( s : String ) -> Result < String , FromHexError > {
39
+ fn validate_channel_id ( s : & str ) -> Result < & str , FromHexError > {
40
40
if s. is_empty ( ) || s. len ( ) != 66 || & s[ 0 ..2 ] != "0x" {
41
41
Err ( FromHexError :: InvalidStringLength )
42
42
} else {
43
- Ok ( s[ 2 ..] . into ( ) )
43
+ Ok ( & s[ 2 ..] )
44
44
}
45
45
}
46
46
@@ -84,7 +84,7 @@ impl FromStr for ChannelId {
84
84
type Err = FromHexError ;
85
85
86
86
fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
87
- ChannelId :: from_hex ( validate_channel_id ( s. into ( ) ) ?)
87
+ ChannelId :: from_hex ( validate_channel_id ( s) ?)
88
88
}
89
89
}
90
90
You can’t perform that action at this time.
0 commit comments