diff options
author | Jason Devers <dev.json2@gmail.com> | 2024-12-12 10:47:53 -0500 |
---|---|---|
committer | Boqun Feng <boqun.feng@gmail.com> | 2025-07-11 15:11:54 -0700 |
commit | 99214efedea521f1b79fa2a28ff142e933fc3eba (patch) | |
tree | 33f034367a669ac3ceacff1aa4ea595247f88cfd /kernel/locking/lockdep.c | |
parent | daec29dcc8731b7596690ab9f647839e4584a86d (diff) |
rust: sync: Add #[must_use] to Lock::try_lock()
The `Lock::try_lock()` function returns an `Option<Guard<...>>`, but it
currently does not issue a warning if the return value is unused.
To avoid potential bugs, the `#[must_use]` annotation is added to ensure
proper usage.
Note that `T` is `#[must_use]` but `Option<T>` is not.
For more context, see: https://github.com/rust-lang/rust/issues/71368.
Suggested-by: Alice Ryhl <aliceryhl@google.com>
Link: https://github.com/Rust-for-Linux/linux/issues/1133
Signed-off-by: Jason Devers <dev.json2@gmail.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Link: https://lore.kernel.org/r/20241212154753.139563-1-dev.json2@gmail.com
Diffstat (limited to 'kernel/locking/lockdep.c')
0 files changed, 0 insertions, 0 deletions