Inherent implementations (one that do not implement a trait but provide methods associated with a type) are always safe because they are not implementing an unsafe trait. Removing the unsafe
keyword from the inherent implementation will resolve this error.
struct Foo; // this will cause this error unsafe impl Foo { } // converting it to this will fix it impl Foo { }