mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
add warn(unsafe_op_in_unsafe_fn)
This commit is contained in:
parent
ce45c1004c
commit
2dc9358085
2 changed files with 7 additions and 3 deletions
|
@ -1,3 +1,4 @@
|
|||
#[warn(unsafe_op_in_unsafe_fn)]
|
||||
pub mod replica;
|
||||
pub mod result;
|
||||
pub mod status;
|
||||
|
|
|
@ -26,17 +26,20 @@ impl TCReplica {
|
|||
/// the lifetime promised by C.
|
||||
pub(crate) unsafe fn from_arg_ref<'a>(tcreplica: *mut TCReplica) -> &'a mut Self {
|
||||
debug_assert!(!tcreplica.is_null());
|
||||
&mut *tcreplica
|
||||
// SAFETY: see doc comment
|
||||
unsafe { &mut *tcreplica }
|
||||
}
|
||||
|
||||
/// Take a TCReplica from C as an argument.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// The pointer must not be NULL. The pointer becomes invalid before this function returns.
|
||||
/// The pointer must not be NULL and must point to a valid replica. The pointer becomes
|
||||
/// invalid before this function returns and must not be used afterward.
|
||||
pub(crate) unsafe fn from_arg(tcreplica: *mut TCReplica) -> Self {
|
||||
debug_assert!(!tcreplica.is_null());
|
||||
*Box::from_raw(tcreplica)
|
||||
// SAFETY: see doc comment
|
||||
unsafe { *Box::from_raw(tcreplica) }
|
||||
}
|
||||
|
||||
/// Convert this to a return value for handing off to C.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue