diff --git a/core/src/path.rs b/core/src/path.rs index 15da4f71..0d1ed626 100644 --- a/core/src/path.rs +++ b/core/src/path.rs @@ -87,7 +87,7 @@ pub struct Ancestors<'a> { path: &'a str, } -impl<'a> Iterator for Ancestors<'a> { +impl Iterator for Ancestors<'_> { type Item = PathBuf; fn next(&mut self) -> Option { if self.path.is_empty() { @@ -118,7 +118,7 @@ impl<'a> Iterator for Ancestors<'a> { } } -impl<'a> FusedIterator for Ancestors<'a> {} +impl FusedIterator for Ancestors<'_> {} /// Iterator over the components of a Path /// @@ -127,7 +127,7 @@ pub struct Iter<'a> { path: &'a str, } -impl<'a> Iterator for Iter<'a> { +impl Iterator for Iter<'_> { type Item = PathBuf; fn next(&mut self) -> Option { if self.path.is_empty() { diff --git a/src/fs.rs b/src/fs.rs index e8a42e91..2de75265 100644 --- a/src/fs.rs +++ b/src/fs.rs @@ -573,7 +573,6 @@ impl<'a, 'b, Storage: driver::Storage> File<'a, 'b, Storage> { /// /// It is equivalent to OpenOptions::new() but allows you to write more readable code. /// This also avoids the need to import OpenOptions`. - pub fn with_options() -> OpenOptions { OpenOptions::new() } @@ -936,7 +935,7 @@ pub struct ReadDir<'a, 'b, S: driver::Storage> { path: &'b Path, } -impl<'a, 'b, S: driver::Storage> Iterator for ReadDir<'a, 'b, S> { +impl Iterator for ReadDir<'_, '_, S> { type Item = Result; // remove this allowance again, once path overflow is properly handled @@ -972,9 +971,9 @@ impl<'a, 'b, S: driver::Storage> Iterator for ReadDir<'a, 'b, S> { } } -impl<'a, 'b, S: driver::Storage> ReadDir<'a, 'b, S> { +impl<'a, S: driver::Storage> ReadDir<'a, '_, S> { // Safety-hatch to experiment with missing parts of API - pub unsafe fn borrow_filesystem<'c>(&'c mut self) -> &'c Filesystem<'a, S> { + pub unsafe fn borrow_filesystem<'b>(&'b mut self) -> &'b Filesystem<'a, S> { self.fs } } diff --git a/src/macros.rs b/src/macros.rs index 34a55304..a3337aa7 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -24,14 +24,20 @@ macro_rules! ram_storage { ( buf: [u8; $block_size * $block_count], } - impl Default for $Backend { - fn default() -> Self { - $Backend { + impl $Backend { + pub const fn new() -> Self { + Self { buf: [$erase_value; $block_size * $block_count], } } } + impl Default for $Backend { + fn default() -> Self { + Self::new() + } + } + pub struct $Name<'backend> { backend: &'backend mut $Backend, }