Merge pull request #21648 from alexanderkjall/borsh-error-compilation-failure

fix smol_str compilation error
This commit is contained in:
Chayim Refael Friedman 2026-02-15 16:42:02 +00:00 committed by GitHub
commit 23a3e642d7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View file

@ -29,8 +29,9 @@ impl BorshDeserialize for SmolStr {
}))
} else {
// u8::vec_from_reader always returns Some on success in current implementation
let vec = u8::vec_from_reader(len, reader)?
.ok_or_else(|| Error::other("u8::vec_from_reader unexpectedly returned None"))?;
let vec = u8::vec_from_reader(len, reader)?.ok_or_else(|| {
Error::new(ErrorKind::Other, "u8::vec_from_reader unexpectedly returned None")
})?;
Ok(SmolStr::from(String::from_utf8(vec).map_err(|err| {
let msg = err.to_string();
Error::new(ErrorKind::InvalidData, msg)

View file

@ -393,7 +393,7 @@ mod test_str_ext {
}
}
#[cfg(feature = "borsh")]
#[cfg(all(feature = "borsh", feature = "std"))]
mod borsh_tests {
use borsh::BorshDeserialize;
use smol_str::{SmolStr, ToSmolStr};