Skip to content

Commit 3f82306

Browse files
fix smol_str compilation error
the command 'cargo build --no-default-features --features borsh' failed with: error[E0599]: no function or associated item named 'other' found for struct 'borsh::io::Error' in the current scope --> lib/smol_str/src/borsh.rs:33:39 | 33 | .ok_or_else(|| Error::other("u8::vec_from_reader unexpectedly returned None"))?; | ^^^^^ function or associated item not found in 'borsh::io::Error' |
1 parent b7d3e7b commit 3f82306

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

lib/smol_str/src/borsh.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ impl BorshDeserialize for SmolStr {
2929
}))
3030
} else {
3131
// u8::vec_from_reader always returns Some on success in current implementation
32-
let vec = u8::vec_from_reader(len, reader)?
33-
.ok_or_else(|| Error::other("u8::vec_from_reader unexpectedly returned None"))?;
32+
let vec = u8::vec_from_reader(len, reader)?.ok_or_else(|| {
33+
Error::new(ErrorKind::Other, "u8::vec_from_reader unexpectedly returned None")
34+
})?;
3435
Ok(SmolStr::from(String::from_utf8(vec).map_err(|err| {
3536
let msg = err.to_string();
3637
Error::new(ErrorKind::InvalidData, msg)

0 commit comments

Comments
 (0)