diff options
| author | Michael Goulet <michael@errs.io> | 2023-08-10 21:17:36 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-10 21:17:36 -0700 |
| commit | 0c241e6bdb191862423dfd4cc0f705a127c2248a (patch) | |
| tree | d341f72947e81828430de4f7f7683aa706651a53 /library/std/src/sys | |
| parent | a9b2c6a0ce700ee6d1cdcab3f3c1f7997ae726d1 (diff) | |
| parent | 558f49d7aae7142864ee98fb26e593c12c1a3cd3 (diff) | |
| download | rust-0c241e6bdb191862423dfd4cc0f705a127c2248a.tar.gz rust-0c241e6bdb191862423dfd4cc0f705a127c2248a.zip | |
Rollup merge of #114194 - thomcc:flushinline, r=cuviper
Inline trivial (noop) flush calls At work I noticed that `writer.flush()?` didn't get optimized away in cases where the flush is obviously a no-op, which I had expected (well, desired). I went through and added `#[inline]` to a bunch of cases that were obviously noops, or delegated to ones that were obviously noops. I omitted platforms I don't have access to (some tier3). I didn't do this very scientifically, in cases where it was non-obvious I left `#[inline]` off.
Diffstat (limited to 'library/std/src/sys')
| -rw-r--r-- | library/std/src/sys/hermit/fs.rs | 1 | ||||
| -rw-r--r-- | library/std/src/sys/unix/fs.rs | 1 | ||||
| -rw-r--r-- | library/std/src/sys/unix/stdio.rs | 2 |
3 files changed, 4 insertions, 0 deletions
diff --git a/library/std/src/sys/hermit/fs.rs b/library/std/src/sys/hermit/fs.rs index 4bb735668d2..6aa4ea7f5b4 100644 --- a/library/std/src/sys/hermit/fs.rs +++ b/library/std/src/sys/hermit/fs.rs @@ -335,6 +335,7 @@ impl File { false } + #[inline] pub fn flush(&self) -> io::Result<()> { Ok(()) } diff --git a/library/std/src/sys/unix/fs.rs b/library/std/src/sys/unix/fs.rs index 7dc809a038b..a5604c92a80 100644 --- a/library/std/src/sys/unix/fs.rs +++ b/library/std/src/sys/unix/fs.rs @@ -1204,6 +1204,7 @@ impl File { self.0.write_vectored_at(bufs, offset) } + #[inline] pub fn flush(&self) -> io::Result<()> { Ok(()) } diff --git a/library/std/src/sys/unix/stdio.rs b/library/std/src/sys/unix/stdio.rs index a26f20795a1..97e75f1b5b6 100644 --- a/library/std/src/sys/unix/stdio.rs +++ b/library/std/src/sys/unix/stdio.rs @@ -54,6 +54,7 @@ impl io::Write for Stdout { true } + #[inline] fn flush(&mut self) -> io::Result<()> { Ok(()) } @@ -81,6 +82,7 @@ impl io::Write for Stderr { true } + #[inline] fn flush(&mut self) -> io::Result<()> { Ok(()) } |
