Fix lints
diff --git a/lib/smol_str/src/borsh.rs b/lib/smol_str/src/borsh.rs
index 362c288..ebb20d7 100644
--- a/lib/smol_str/src/borsh.rs
+++ b/lib/smol_str/src/borsh.rs
@@ -1,8 +1,10 @@
use crate::{Repr, SmolStr, INLINE_CAP};
use alloc::string::{String, ToString};
-use borsh::io::{Error, ErrorKind, Read, Write};
-use borsh::{BorshDeserialize, BorshSerialize};
-use core::intrinsics::transmute;
+use borsh::{
+ io::{Error, ErrorKind, Read, Write},
+ BorshDeserialize, BorshSerialize,
+};
+use core::mem::transmute;
impl BorshSerialize for SmolStr {
fn serialize<W: Write>(&self, writer: &mut W) -> borsh::io::Result<()> {
@@ -27,12 +29,8 @@
}))
} 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::new(
- ErrorKind::Other,
- "u8::vec_from_reader unexpectedly returned None".to_string(),
- )
- })?;
+ let vec = u8::vec_from_reader(len, reader)?
+ .ok_or_else(|| Error::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)
diff --git a/lib/smol_str/src/lib.rs b/lib/smol_str/src/lib.rs
index bf88f57..d76f029 100644
--- a/lib/smol_str/src/lib.rs
+++ b/lib/smol_str/src/lib.rs
@@ -161,7 +161,7 @@
}
}
-impl<'a> PartialEq<SmolStr> for &'a str {
+impl PartialEq<SmolStr> for &str {
#[inline(always)]
fn eq(&self, other: &SmolStr) -> bool {
*self == other
@@ -189,7 +189,7 @@
}
}
-impl<'a> PartialEq<SmolStr> for &'a String {
+impl PartialEq<SmolStr> for &String {
#[inline(always)]
fn eq(&self, other: &SmolStr) -> bool {
*self == other
@@ -380,7 +380,7 @@
impl From<Arc<str>> for SmolStr {
#[inline]
fn from(s: Arc<str>) -> SmolStr {
- let repr = Repr::new_on_stack(s.as_ref()).unwrap_or_else(|| Repr::Heap(s));
+ let repr = Repr::new_on_stack(s.as_ref()).unwrap_or(Repr::Heap(s));
Self(repr)
}
}
diff --git a/lib/smol_str/tests/test.rs b/lib/smol_str/tests/test.rs
index 96b8b8f..0070b3a 100644
--- a/lib/smol_str/tests/test.rs
+++ b/lib/smol_str/tests/test.rs
@@ -390,8 +390,8 @@
assert!(!result.is_heap_allocated());
}
}
-#[cfg(feature = "borsh")]
+#[cfg(feature = "borsh")]
mod borsh_tests {
use borsh::BorshDeserialize;
use smol_str::{SmolStr, ToSmolStr};