johnstonskj / rust-email_address

A Rust crate providing an implementation of an RFC-compliant `EmailAddress` newtype.
MIT License
64 stars 12 forks source link

Remove manual unsafe Send + Sync impl for Error #7

Closed kbalt closed 2 years ago

kbalt commented 2 years ago

https://github.com/johnstonskj/rust-email_address/blob/b31a959c802354b854360de0f1d04110b805576d/src/lib.rs#L394

This is a manual implementation of Send + Sync for Error which doesn't seem to do anything as these traits should be auto-implemented by the compiler? This just unnecessarily increases the unsafe count for this lib.

ssokolow commented 2 years ago

Agreed. When I saw those:

  1. I was torn over whether to go back to my old regex-based solution, since regex is on the list of crates I trust to use unsafe responsibly.
  2. I saw it as "Either this does nothing or this code is unsound in the presence of threads".

Either way, it doesn't reflect well on this crate (especially since, by its very nature, its primary niche is in code which processes untrusted input) and, until it's fixed I'll be limiting my use of it to private projects where I cargo clone email_address, remove those lines, and then use email_address = { version = "0.2.1", path = "email_address" } in my Cargo.toml.

johnstonskj commented 2 years ago

Released in v0.2.2

ssokolow commented 2 years ago

Thanks for the quick fix on this and #8.

I just finished switching off the path dependency and it's nice to have a proper checksum = "666197bb14172e8ed0573907a6fe5138d11d9c126f93f5f4bd2cb0466a6d8f8f" line in my Cargo.lock again.