Merge pull request #107 from paritytech/fix-deserialize-str

fix(serde deser): fix indexing into `str` bug
This commit is contained in:
Andronik Ordian 2019-02-14 15:24:07 +03:00 committed by GitHub
commit 9abaf267d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -81,7 +81,7 @@ pub fn deserialize_check_len<'de, D>(deserializer: D, len: ExpectedLen) -> Resul
}
fn visit_str<E: de::Error>(self, v: &str) -> Result<Self::Value, E> {
if v.len() < 2 || &v[0..2] != "0x" {
if !v.starts_with("0x") {
return Err(E::custom("prefix is missing"))
}