Skip to content

Commit 2f6daae

Browse files
committed
clippy: add safety sections to unsafe functions
1 parent f39e205 commit 2f6daae

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/api.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ impl Keyring {
9090
/// Instantiate a keyring from an ID.
9191
///
9292
/// This is unsafe because no keyring is known to exist with the given ID.
93+
///
94+
/// # Safety
95+
///
96+
/// This method assumes that the given serial is a valid keyring ID at the kernel level.
9397
pub unsafe fn new(id: KeyringSerial) -> Self {
9498
Keyring {
9599
id,
@@ -471,6 +475,10 @@ impl Key {
471475
/// Instantiate a key from an ID.
472476
///
473477
/// This is unsafe because no key is known to exist with the given ID.
478+
///
479+
/// # Safety
480+
///
481+
/// This method assumes that the given serial is a valid key ID at the kernel level.
474482
pub unsafe fn new(id: KeyringSerial) -> Self {
475483
Self::new_impl(id)
476484
}

0 commit comments

Comments
 (0)