Replaced Box<dyn Iterator... with impl Iterator

This commit is contained in:
ChristianVisintin
2021-01-16 10:37:53 +01:00
parent 0393c1a850
commit bf56a269e0
3 changed files with 5 additions and 5 deletions

View File

@@ -137,7 +137,7 @@ impl FileExplorer {
/// ///
/// Iterate over files /// Iterate over files
/// Filters are applied based on current options (e.g. hidden files not returned) /// Filters are applied based on current options (e.g. hidden files not returned)
pub fn iter_files(&self) -> Box<dyn Iterator<Item = &FsEntry> + '_> { pub fn iter_files(&self) -> impl Iterator<Item = &FsEntry> + '_ {
// Filter // Filter
let opts: ExplorerOpts = self.opts; let opts: ExplorerOpts = self.opts;
Box::new(self.files.iter().filter(move |x| { Box::new(self.files.iter().filter(move |x| {
@@ -154,7 +154,7 @@ impl FileExplorer {
/// ### iter_files_all /// ### iter_files_all
/// ///
/// Iterate all files; doesn't care about options /// Iterate all files; doesn't care about options
pub fn iter_files_all(&self) -> Box<dyn Iterator<Item = &FsEntry> + '_> { pub fn iter_files_all(&self) -> impl Iterator<Item = &FsEntry> + '_ {
Box::new(self.files.iter()) Box::new(self.files.iter())
} }

View File

@@ -96,7 +96,7 @@ impl BookmarksClient {
/// ### iter_bookmarks /// ### iter_bookmarks
/// ///
/// Iterate over bookmarks keys /// Iterate over bookmarks keys
pub fn iter_bookmarks(&self) -> Box<dyn Iterator<Item = &String> + '_> { pub fn iter_bookmarks(&self) -> impl Iterator<Item = &String> + '_ {
Box::new(self.hosts.bookmarks.keys()) Box::new(self.hosts.bookmarks.keys())
} }
@@ -156,7 +156,7 @@ impl BookmarksClient {
/// ### iter_recents /// ### iter_recents
/// ///
/// Iterate over recents keys /// Iterate over recents keys
pub fn iter_recents(&self) -> Box<dyn Iterator<Item = &String> + '_> { pub fn iter_recents(&self) -> impl Iterator<Item = &String> + '_ {
Box::new(self.hosts.recents.keys()) Box::new(self.hosts.recents.keys())
} }

View File

@@ -242,7 +242,7 @@ impl ConfigClient {
/// ### iter_ssh_keys /// ### iter_ssh_keys
/// ///
/// Get an iterator through hosts in the ssh key storage /// Get an iterator through hosts in the ssh key storage
pub fn iter_ssh_keys(&self) -> Box<dyn Iterator<Item = &String> + '_> { pub fn iter_ssh_keys(&self) -> impl Iterator<Item = &String> + '_ {
Box::new(self.config.remote.ssh_keys.keys()) Box::new(self.config.remote.ssh_keys.keys())
} }