Skip to content

Commit ad153d8

Browse files
committed
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.
1 parent 37f4f00 commit ad153d8

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

secp256k1-sys/src/lib.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ impl_raw_debug!(PublicKey);
109109
impl PublicKey {
110110
/// Creates an "uninitialized" FFI public key which is zeroed out
111111
///
112+
/// # Safety
113+
///
112114
/// If you pass this to any FFI functions, except as an out-pointer,
113115
/// the result is likely to be an assertation failure and process
114116
/// termination.
@@ -118,6 +120,8 @@ impl PublicKey {
118120

119121
/// Create a new public key usable for the FFI interface from raw bytes
120122
///
123+
/// # Safety
124+
///
121125
/// Does not check the validity of the underlying representation. If it is
122126
/// invalid the result may be assertation failures (and process aborts) from
123127
/// the underlying library. You should not use this method except with data
@@ -145,6 +149,8 @@ impl_raw_debug!(Signature);
145149
impl Signature {
146150
/// Creates an "uninitialized" FFI signature which is zeroed out
147151
///
152+
/// # Safety
153+
///
148154
/// If you pass this to any FFI functions, except as an out-pointer,
149155
/// the result is likely to be an assertation failure and process
150156
/// termination.
@@ -154,6 +160,8 @@ impl Signature {
154160

155161
/// Create a new signature usable for the FFI interface from raw bytes
156162
///
163+
/// # Safety
164+
///
157165
/// Does not check the validity of the underlying representation. If it is
158166
/// invalid the result may be assertation failures (and process aborts) from
159167
/// the underlying library. You should not use this method except with data
@@ -180,6 +188,8 @@ impl_raw_debug!(XOnlyPublicKey);
180188
impl XOnlyPublicKey {
181189
/// Creates an "uninitialized" FFI x-only public key which is zeroed out
182190
///
191+
/// # Safety
192+
///
183193
/// If you pass this to any FFI functions, except as an out-pointer,
184194
/// the result is likely to be an assertation failure and process
185195
/// termination.
@@ -189,6 +199,8 @@ impl XOnlyPublicKey {
189199

190200
/// Create a new x-only public key usable for the FFI interface from raw bytes
191201
///
202+
/// # Safety
203+
///
192204
/// Does not check the validity of the underlying representation. If it is
193205
/// invalid the result may be assertation failures (and process aborts) from
194206
/// the underlying library. You should not use this method except with data
@@ -215,6 +227,8 @@ impl_raw_debug!(KeyPair);
215227
impl KeyPair {
216228
/// Creates an "uninitialized" FFI keypair which is zeroed out
217229
///
230+
/// # Safety
231+
///
218232
/// If you pass this to any FFI functions, except as an out-pointer,
219233
/// the result is likely to be an assertation failure and process
220234
/// termination.
@@ -224,6 +238,8 @@ impl KeyPair {
224238

225239
/// Create a new keypair usable for the FFI interface from raw bytes
226240
///
241+
/// # Safety
242+
///
227243
/// Does not check the validity of the underlying representation. If it is
228244
/// invalid the result may be assertation failures (and process aborts) from
229245
/// the underlying library. You should not use this method except with data

0 commit comments

Comments
 (0)