Skip to content

Commit

Permalink
Use map instead of ?
Browse files Browse the repository at this point in the history
  • Loading branch information
novacrazy committed Sep 7, 2024
1 parent 0c24926 commit f52f821
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion postgres-types/src/smol_str_02.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{FromSql, IsNull, ToSql, Type};

impl<'a> FromSql<'a> for SmolStr {
fn from_sql(ty: &Type, raw: &'a [u8]) -> Result<Self, Box<dyn Error + Sync + Send>> {
Ok(SmolStr::new(<&str as FromSql>::from_sql(ty, raw)?))
<&str as FromSql>::from_sql(ty, raw).map(SmolStr::new)
}

fn accepts(ty: &Type) -> bool {
Expand Down

0 comments on commit f52f821

Please sign in to comment.