未验证 提交 0c241e6b 编写于 作者: M Michael Goulet 提交者: GitHub

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.
......@@ -791,6 +791,7 @@ fn is_write_vectored(&self) -> bool {
self.inner.is_write_vectored()
}
#[inline]
fn flush(&mut self) -> io::Result<()> {
self.inner.flush()
}
......@@ -836,6 +837,7 @@ fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> io::Result<usize> {
fn is_write_vectored(&self) -> bool {
(&&*self).is_write_vectored()
}
#[inline]
fn flush(&mut self) -> io::Result<()> {
(&*self).flush()
}
......@@ -881,6 +883,7 @@ fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> io::Result<usize> {
fn is_write_vectored(&self) -> bool {
(&**self).is_write_vectored()
}
#[inline]
fn flush(&mut self) -> io::Result<()> {
(&**self).flush()
}
......
......@@ -310,6 +310,7 @@ fn write(&mut self, buf: &[u8]) -> Result<usize> {
Ok(buf.len())
}
#[inline]
fn flush(&mut self) -> Result<()> {
Ok(())
}
......
......@@ -647,6 +647,7 @@ fn is_write_vectored(&self) -> bool {
self.0.is_write_vectored()
}
#[inline]
fn flush(&mut self) -> io::Result<()> {
Ok(())
}
......@@ -685,6 +686,7 @@ fn is_write_vectored(&self) -> bool {
self.0.is_write_vectored()
}
#[inline]
fn flush(&mut self) -> io::Result<()> {
Ok(())
}
......
......@@ -712,6 +712,7 @@ fn is_write_vectored(&self) -> bool {
self.0.is_write_vectored()
}
#[inline]
fn flush(&mut self) -> io::Result<()> {
Ok(())
}
......
......@@ -280,6 +280,7 @@ fn is_write_vectored(&self) -> bool {
io::Write::is_write_vectored(&&*self)
}
#[inline]
fn flush(&mut self) -> io::Result<()> {
(&*self).flush()
}
......@@ -299,6 +300,7 @@ fn is_write_vectored(&self) -> bool {
self.inner.is_write_vectored()
}
#[inline]
fn flush(&mut self) -> io::Result<()> {
Ok(())
}
......
......@@ -335,6 +335,7 @@ pub fn is_write_vectored(&self) -> bool {
false
}
#[inline]
pub fn flush(&self) -> io::Result<()> {
Ok(())
}
......
......@@ -1204,6 +1204,7 @@ pub fn write_vectored_at(&self, bufs: &[IoSlice<'_>], offset: u64) -> io::Result
self.0.write_vectored_at(bufs, offset)
}
#[inline]
pub fn flush(&self) -> io::Result<()> {
Ok(())
}
......
......@@ -54,6 +54,7 @@ fn is_write_vectored(&self) -> bool {
true
}
#[inline]
fn flush(&mut self) -> io::Result<()> {
Ok(())
}
......@@ -81,6 +82,7 @@ fn is_write_vectored(&self) -> bool {
true
}
#[inline]
fn flush(&mut self) -> io::Result<()> {
Ok(())
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册