mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Fix: revert strange usage of ?
operator
This commit is contained in:
parent
27605b402e
commit
0986632c04
1 changed files with 8 additions and 9 deletions
|
@ -111,9 +111,7 @@ impl Vfs {
|
||||||
|
|
||||||
/// Id of the given path if it exists in the `Vfs` and is not deleted.
|
/// Id of the given path if it exists in the `Vfs` and is not deleted.
|
||||||
pub fn file_id(&self, path: &VfsPath) -> Option<FileId> {
|
pub fn file_id(&self, path: &VfsPath) -> Option<FileId> {
|
||||||
let it = self.interner.get(path)?;
|
self.interner.get(path).filter(|&it| self.get(it).is_some())
|
||||||
let _ = self.get(it).as_ref()?;
|
|
||||||
Some(it)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// File path corresponding to the given `file_id`.
|
/// File path corresponding to the given `file_id`.
|
||||||
|
@ -139,11 +137,12 @@ impl Vfs {
|
||||||
///
|
///
|
||||||
/// This will skip deleted files.
|
/// This will skip deleted files.
|
||||||
pub fn iter(&self) -> impl Iterator<Item = (FileId, &VfsPath)> + '_ {
|
pub fn iter(&self) -> impl Iterator<Item = (FileId, &VfsPath)> + '_ {
|
||||||
(0..self.data.len()).filter_map(move |it| {
|
(0..self.data.len())
|
||||||
let file_id = FileId(it as u32);
|
.map(|it| FileId(it as u32))
|
||||||
let _ = self.get(file_id).as_ref()?;
|
.filter(move |&file_id| self.get(file_id).is_some())
|
||||||
|
.map(move |file_id| {
|
||||||
let path = self.interner.lookup(file_id);
|
let path = self.interner.lookup(file_id);
|
||||||
Some((file_id, path))
|
(file_id, path)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue