File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -111,9 +111,7 @@ impl Vfs {
111
111
112
112
/// Id of the given path if it exists in the `Vfs` and is not deleted.
113
113
pub fn file_id ( & self , path : & VfsPath ) -> Option < FileId > {
114
- let it = self . interner . get ( path) ?;
115
- let _ = self . get ( it) . as_ref ( ) ?;
116
- Some ( it)
114
+ self . interner . get ( path) . filter ( |& it| self . get ( it) . is_some ( ) )
117
115
}
118
116
119
117
/// File path corresponding to the given `file_id`.
@@ -139,12 +137,13 @@ impl Vfs {
139
137
///
140
138
/// This will skip deleted files.
141
139
pub fn iter ( & self ) -> impl Iterator < Item = ( FileId , & VfsPath ) > + ' _ {
142
- ( 0 ..self . data . len ( ) ) . filter_map ( move |it| {
143
- let file_id = FileId ( it as u32 ) ;
144
- let _ = self . get ( file_id) . as_ref ( ) ?;
145
- let path = self . interner . lookup ( file_id) ;
146
- Some ( ( file_id, path) )
147
- } )
140
+ ( 0 ..self . data . len ( ) )
141
+ . map ( |it| FileId ( it as u32 ) )
142
+ . filter ( move |& file_id| self . get ( file_id) . is_some ( ) )
143
+ . map ( move |file_id| {
144
+ let path = self . interner . lookup ( file_id) ;
145
+ ( file_id, path)
146
+ } )
148
147
}
149
148
150
149
/// Update the `path` with the given `contents`. `None` means the file was deleted.
You can’t perform that action at this time.
0 commit comments