Skip to content

Commit 7a9d0cc

Browse files
committed
Add some must_use to jemalloc-ctl key APIs
1 parent 562a530 commit 7a9d0cc

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

jemalloc-ctl/src/keys.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ impl Name {
8888

8989
/// Returns `true` if `self` is a key in the _MALLCTL NAMESPCE_ referring to
9090
/// a null-terminated string.
91+
#[must_use]
9192
pub fn value_type_str(&self) -> bool {
9293
// remove the null-terminator:
9394
let name = self.0.split_at(self.0.len() - 1).0;
@@ -117,6 +118,7 @@ impl Name {
117118
}
118119

119120
/// Returns the name as null-terminated byte-string.
121+
#[must_use]
120122
pub fn as_bytes(&self) -> &'static [u8] {
121123
unsafe { &*(self as *const Self as *const [u8]) }
122124
}

jemalloc-ctl/src/macros.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ macro_rules! types {
2222
/// Returns Management Information Base (MIB)
2323
///
2424
/// This value can be used to access the key without doing string lookup.
25+
#[must_use]
2526
pub fn mib() -> ::error::Result<[<$id _mib>]> {
2627
Ok([<$id _mib>](Self::NAME.$name_to_mib()?))
2728
}
2829

2930
/// Key [`::keys::Name`].
31+
#[must_use]
3032
pub fn name() -> &'static ::keys::Name {
3133
Self::NAME
3234
}

0 commit comments

Comments
 (0)