Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

Commit

Permalink
Add #[must_use] to some FFI functions
Browse files Browse the repository at this point in the history
  • Loading branch information
morrisonlevi committed Mar 30, 2022
1 parent 6b9bfbf commit 4fb22b3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ddprof-ffi/src/exporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ fn try_to_endpoint(
}
}

#[must_use]
#[export_name = "ddprof_ffi_ProfileExporterV3_new"]
pub extern "C" fn profile_exporter_new(
family: CharSlice,
Expand Down Expand Up @@ -231,6 +232,7 @@ pub unsafe extern "C" fn profile_exporter_build(
/// # Safety
/// If the `exporter` and `request` are non-null, then they need to have been
/// created by apis in this module.
#[must_use]
#[export_name = "ddprof_ffi_ProfileExporterV3_send"]
pub unsafe extern "C" fn profile_exporter_send(
exporter: Option<NonNull<ProfileExporterV3>>,
Expand Down Expand Up @@ -267,6 +269,7 @@ pub unsafe extern "C" fn send_result_drop(result: SendResult) {
std::mem::drop(result)
}

#[must_use]
#[export_name = "ddprof_ffi_Vec_tag_new"]
pub extern "C" fn vec_tag_new<'a>() -> crate::Vec<Tag<'a>> {
crate::Vec::default()
Expand Down Expand Up @@ -367,6 +370,7 @@ pub extern "C" fn vec_tag_result_drop(result: VecTagResult) {
std::mem::drop(result)
}

#[must_use]
#[export_name = "ddprof_ffi_Vec_tag_parse"]
pub extern "C" fn vec_tag_parse(string: CharSlice) -> VecTagResult {
match string.try_into() {
Expand All @@ -379,6 +383,7 @@ pub extern "C" fn vec_tag_parse(string: CharSlice) -> VecTagResult {
}
}

#[must_use]
#[allow(clippy::ptr_arg)]
#[export_name = "ddprof_ffi_Vec_tag_clone"]
pub extern "C" fn vec_tag_clone<'a>(vec: &'a crate::Vec<Tag<'a>>) -> VecTagResult {
Expand Down

0 comments on commit 4fb22b3

Please sign in to comment.