Skip to content

Commit a20214d

Browse files
oech3sylvestre
authored andcommitted
pipes.rs: simplify dev_null & remove crate name from comment
1 parent 157bbab commit a20214d

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

src/uucore/src/lib/features/pipes.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// For the full copyright and license information, please view the LICENSE
44
// file that was distributed with this source code.
55

6-
//! Thin zero-copy-related wrappers around functions from the `rustix` crate.
6+
//! Thin zero-copy-related wrappers around functions.
77
88
#[cfg(any(target_os = "linux", target_os = "android"))]
99
use rustix::pipe::{SpliceFlags, fcntl_setpipe_size};
@@ -39,7 +39,7 @@ pub fn pipe<const SIZE_REQUIRED: bool>(s: usize) -> std::io::Result<(PipeReader,
3939
Ok(pair)
4040
}
4141

42-
/// Less noisy wrapper around [`rustix::pipe::splice`].
42+
/// Less noisy wrapper around splice syscall
4343
///
4444
/// Up to `len` bytes are moved from `source` to `target`. Returns the number
4545
/// of successfully moved bytes.
@@ -245,14 +245,10 @@ pub fn dev_null() -> Option<File> {
245245
.ok()?;
246246
let stat = rustix::fs::fstat(&null).ok()?;
247247
let dev = stat.st_rdev;
248-
if (rustix::fs::major(dev), rustix::fs::minor(dev)) == (1, 3) {
249-
Some(null)
250-
} else {
251-
None
252-
}
248+
((rustix::fs::major(dev), rustix::fs::minor(dev)) == (1, 3)).then_some(null)
253249
}
254250

255-
// Less noisy wrapper around [`rustix::pipe::tee`]
251+
// Less noisy wrapper around tee syscall
256252
#[inline]
257253
#[cfg(any(target_os = "linux", target_os = "android"))]
258254
pub fn tee(source: &impl AsFd, target: &impl AsFd, len: usize) -> rustix::io::Result<usize> {

0 commit comments

Comments
 (0)