Skip to content

Commit 016bc16

Browse files
committed
io: make clippy happy
1 parent 3e52ec7 commit 016bc16

File tree

3 files changed

+67
-5
lines changed

3 files changed

+67
-5
lines changed

embedded-io-adapters/src/std.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
//! Adapters to/from `std::io` traits.
22
3-
#![deny(
4-
clippy::missing_trait_methods,
5-
reason = "Methods should be forwarded to the underlying type"
6-
)]
7-
83
use embedded_io::Error as _;
94

105
/// Adapter from `std::io` traits.
@@ -41,6 +36,10 @@ impl<T: ?Sized> embedded_io::ErrorType for FromStd<T> {
4136
type Error = std::io::Error;
4237
}
4338

39+
#[deny(
40+
clippy::missing_trait_methods,
41+
reason = "Methods should be forwarded to the underlying type"
42+
)]
4443
impl<T: std::io::Read + ?Sized> embedded_io::Read for FromStd<T> {
4544
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error> {
4645
self.inner.read(buf)
@@ -60,6 +59,10 @@ impl<T: std::io::Read + ?Sized> embedded_io::Read for FromStd<T> {
6059
}
6160
}
6261

62+
#[deny(
63+
clippy::missing_trait_methods,
64+
reason = "Methods should be forwarded to the underlying type"
65+
)]
6366
impl<T: std::io::BufRead + ?Sized> embedded_io::BufRead for FromStd<T> {
6467
fn fill_buf(&mut self) -> Result<&[u8], Self::Error> {
6568
self.inner.fill_buf()
@@ -70,6 +73,10 @@ impl<T: std::io::BufRead + ?Sized> embedded_io::BufRead for FromStd<T> {
7073
}
7174
}
7275

76+
#[deny(
77+
clippy::missing_trait_methods,
78+
reason = "Methods should be forwarded to the underlying type"
79+
)]
7380
impl<T: std::io::Write + ?Sized> embedded_io::Write for FromStd<T> {
7481
fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error> {
7582
match self.inner.write(buf) {
@@ -95,6 +102,10 @@ impl<T: std::io::Write + ?Sized> embedded_io::Write for FromStd<T> {
95102
}
96103
}
97104

105+
#[deny(
106+
clippy::missing_trait_methods,
107+
reason = "Methods should be forwarded to the underlying type"
108+
)]
98109
impl<T: std::io::Seek + ?Sized> embedded_io::Seek for FromStd<T> {
99110
fn seek(&mut self, pos: embedded_io::SeekFrom) -> Result<u64, Self::Error> {
100111
self.inner.seek(pos.into())

embedded-io-async/src/impls/boxx.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ impl<T: ?Sized + Read> Read for Box<T> {
1212
async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error> {
1313
T::read(self, buf).await
1414
}
15+
16+
#[inline]
17+
async fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), embedded_io::ReadExactError<Self::Error>> {
18+
T::read_exact(self, buf).await
19+
}
1520
}
1621

1722
#[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))]
@@ -34,6 +39,11 @@ impl<T: ?Sized + Write> Write for Box<T> {
3439
T::write(self, buf).await
3540
}
3641

42+
#[inline]
43+
async fn write_all(&mut self, buf: &[u8]) -> Result<(), Self::Error> {
44+
T::write_all(self, buf).await
45+
}
46+
3747
#[inline]
3848
async fn flush(&mut self) -> Result<(), Self::Error> {
3949
T::flush(self).await
@@ -46,4 +56,14 @@ impl<T: ?Sized + Seek> Seek for Box<T> {
4656
async fn seek(&mut self, pos: SeekFrom) -> Result<u64, Self::Error> {
4757
T::seek(self, pos).await
4858
}
59+
60+
#[inline]
61+
async fn rewind(&mut self) -> Result<(), Self::Error> {
62+
T::rewind(self).await
63+
}
64+
65+
#[inline]
66+
async fn stream_position(&mut self) -> Result<u64, Self::Error> {
67+
T::stream_position(self).await
68+
}
4969
}

embedded-io/src/impls/boxx.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,21 @@ impl<T: ?Sized + Read> Read for Box<T> {
1717
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error> {
1818
T::read(self, buf)
1919
}
20+
21+
#[inline]
22+
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), crate::ReadExactError<Self::Error>> {
23+
T::read_exact(self, buf)
24+
}
2025
}
2126

2227
#[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))]
2328
impl<T: ?Sized + BufRead> BufRead for Box<T> {
29+
#[inline]
2430
fn fill_buf(&mut self) -> Result<&[u8], Self::Error> {
2531
T::fill_buf(self)
2632
}
2733

34+
#[inline]
2835
fn consume(&mut self, amt: usize) {
2936
T::consume(self, amt);
3037
}
@@ -37,6 +44,16 @@ impl<T: ?Sized + Write> Write for Box<T> {
3744
T::write(self, buf)
3845
}
3946

47+
#[inline]
48+
fn write_all(&mut self, buf: &[u8]) -> Result<(), Self::Error> {
49+
T::write_all(self, buf)
50+
}
51+
52+
#[inline]
53+
fn write_fmt(&mut self, fmt: core::fmt::Arguments<'_>) -> Result<(), crate::WriteFmtError<Self::Error>> {
54+
T::write_fmt(self, fmt)
55+
}
56+
4057
#[inline]
4158
fn flush(&mut self) -> Result<(), Self::Error> {
4259
T::flush(self)
@@ -49,6 +66,20 @@ impl<T: ?Sized + Seek> Seek for Box<T> {
4966
fn seek(&mut self, pos: crate::SeekFrom) -> Result<u64, Self::Error> {
5067
T::seek(self, pos)
5168
}
69+
70+
fn rewind(&mut self) -> Result<(), Self::Error> {
71+
T::rewind(self)
72+
}
73+
74+
#[inline]
75+
fn seek_relative(&mut self, offset: i64) -> Result<(), Self::Error> {
76+
T::seek_relative(self, offset)
77+
}
78+
79+
#[inline]
80+
fn stream_position(&mut self) -> Result<u64, Self::Error> {
81+
T::stream_position(self)
82+
}
5283
}
5384

5485
#[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))]

0 commit comments

Comments
 (0)