Skip to content

Commit 3fddbf7

Browse files
rmjaeldruin
authored andcommitted
Use impl_trait_projections
1 parent 17e51e9 commit 3fddbf7

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

embedded-storage-async/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
66
#![no_std]
77
#![feature(async_fn_in_trait)]
8+
#![feature(impl_trait_projections)]
89
#![allow(incomplete_features)]
910

1011
pub mod nor_flash;

embedded-storage-async/src/nor_flash.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,7 @@ pub trait NorFlash: ReadNorFlash {
5252
impl<T: ReadNorFlash> ReadNorFlash for &mut T {
5353
const READ_SIZE: usize = T::READ_SIZE;
5454

55-
async fn read(
56-
&mut self,
57-
offset: u32,
58-
bytes: &mut [u8],
59-
) -> Result<(), <&mut T as ErrorType>::Error> {
55+
async fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error> {
6056
T::read(self, offset, bytes).await
6157
}
6258

@@ -69,15 +65,11 @@ impl<T: NorFlash> NorFlash for &mut T {
6965
const WRITE_SIZE: usize = T::WRITE_SIZE;
7066
const ERASE_SIZE: usize = T::ERASE_SIZE;
7167

72-
async fn erase(&mut self, from: u32, to: u32) -> Result<(), <&mut T as ErrorType>::Error> {
68+
async fn erase(&mut self, from: u32, to: u32) -> Result<(), Self::Error> {
7369
T::erase(self, from, to).await
7470
}
7571

76-
async fn write(
77-
&mut self,
78-
offset: u32,
79-
bytes: &[u8],
80-
) -> Result<(), <&mut T as ErrorType>::Error> {
72+
async fn write(&mut self, offset: u32, bytes: &[u8]) -> Result<(), Self::Error> {
8173
T::write(self, offset, bytes).await
8274
}
8375
}

0 commit comments

Comments
 (0)