Add safety rustdoc headings

Clippy warns about unsafe code without a `# Safety` section. A bunch of
these warnings are for functions that do actually have safety docs.

Follow rustdoc convention and add a `# Safety` section for the already
existing explanations.
This commit is contained in:
Tobin C. Harding 2022-04-27 10:20:02 +10:00
parent 37f4f005d1
commit ad153d82f7
1 changed files with 16 additions and 0 deletions

View File

@ -109,6 +109,8 @@ impl_raw_debug!(PublicKey);
impl PublicKey {
/// Creates an "uninitialized" FFI public key which is zeroed out
///
/// # Safety
///
/// If you pass this to any FFI functions, except as an out-pointer,
/// the result is likely to be an assertation failure and process
/// termination.
@ -118,6 +120,8 @@ impl PublicKey {
/// Create a new public key usable for the FFI interface from raw bytes
///
/// # Safety
///
/// Does not check the validity of the underlying representation. If it is
/// invalid the result may be assertation failures (and process aborts) from
/// the underlying library. You should not use this method except with data
@ -145,6 +149,8 @@ impl_raw_debug!(Signature);
impl Signature {
/// Creates an "uninitialized" FFI signature which is zeroed out
///
/// # Safety
///
/// If you pass this to any FFI functions, except as an out-pointer,
/// the result is likely to be an assertation failure and process
/// termination.
@ -154,6 +160,8 @@ impl Signature {
/// Create a new signature usable for the FFI interface from raw bytes
///
/// # Safety
///
/// Does not check the validity of the underlying representation. If it is
/// invalid the result may be assertation failures (and process aborts) from
/// the underlying library. You should not use this method except with data
@ -180,6 +188,8 @@ impl_raw_debug!(XOnlyPublicKey);
impl XOnlyPublicKey {
/// Creates an "uninitialized" FFI x-only public key which is zeroed out
///
/// # Safety
///
/// If you pass this to any FFI functions, except as an out-pointer,
/// the result is likely to be an assertation failure and process
/// termination.
@ -189,6 +199,8 @@ impl XOnlyPublicKey {
/// Create a new x-only public key usable for the FFI interface from raw bytes
///
/// # Safety
///
/// Does not check the validity of the underlying representation. If it is
/// invalid the result may be assertation failures (and process aborts) from
/// the underlying library. You should not use this method except with data
@ -215,6 +227,8 @@ impl_raw_debug!(KeyPair);
impl KeyPair {
/// Creates an "uninitialized" FFI keypair which is zeroed out
///
/// # Safety
///
/// If you pass this to any FFI functions, except as an out-pointer,
/// the result is likely to be an assertation failure and process
/// termination.
@ -224,6 +238,8 @@ impl KeyPair {
/// Create a new keypair usable for the FFI interface from raw bytes
///
/// # Safety
///
/// Does not check the validity of the underlying representation. If it is
/// invalid the result may be assertation failures (and process aborts) from
/// the underlying library. You should not use this method except with data