Skip to content

Commit 5f71467

Browse files
bors[bot]rtzoeller
andauthored
Merge #1613
1613: Fix clippy warning by adding #[must_use] r=asomers a=rtzoeller Clippy added a lint for non-constructor methods which return `self`, encouraging them to be marked as `#[must_use]`. Mark the methods which are failing with the latest nightly's clippy. ``` $ cargo clippy warning: missing `#[must_use]` attribute on a method returning `Self` --> src/sys/aio.rs:1068:5 | 1068 | / pub fn emplace_slice(mut self, fd: RawFd, offs: off_t, buf: &'a [u8], 1069 | | prio: libc::c_int, sigev_notify: SigevNotify, 1070 | | opcode: LioOpcode) -> Self 1071 | | { ... | 1074 | | self 1075 | | } | |_____^ | = note: `#[warn(clippy::return_self_not_must_use)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#return_self_not_must_use warning: missing `#[must_use]` attribute on a method returning `Self` --> src/sys/aio.rs:1084:5 | 1084 | / pub fn emplace_mut_slice(mut self, fd: RawFd, offs: off_t, 1085 | | buf: &'a mut [u8], prio: libc::c_int, 1086 | | sigev_notify: SigevNotify, opcode: LioOpcode) 1087 | | -> Self ... | 1091 | | self 1092 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#return_self_not_must_use warning: `nix` (lib) generated 2 warnings Finished dev [unoptimized + debuginfo] target(s) in 0.01s ``` Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
2 parents cc55fd2 + 329f661 commit 5f71467

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/sys/aio.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,6 +1065,7 @@ impl<'a> LioCbBuilder<'a> {
10651065
///
10661066
/// [`LioCb`]: struct.LioCb.html
10671067
/// [`AioCb::from_slice`]: struct.AioCb.html#method.from_slice
1068+
#[must_use]
10681069
pub fn emplace_slice(mut self, fd: RawFd, offs: off_t, buf: &'a [u8],
10691070
prio: libc::c_int, sigev_notify: SigevNotify,
10701071
opcode: LioOpcode) -> Self
@@ -1081,6 +1082,7 @@ impl<'a> LioCbBuilder<'a> {
10811082
///
10821083
/// [`LioCb`]: struct.LioCb.html
10831084
/// [`AioCb::from_mut_slice`]: struct.AioCb.html#method.from_mut_slice
1085+
#[must_use]
10841086
pub fn emplace_mut_slice(mut self, fd: RawFd, offs: off_t,
10851087
buf: &'a mut [u8], prio: libc::c_int,
10861088
sigev_notify: SigevNotify, opcode: LioOpcode)

0 commit comments

Comments
 (0)