mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 15:15:24 +00:00
Cleanup
This commit is contained in:
parent
b039f0d1ba
commit
12831b74af
4 changed files with 33 additions and 27 deletions
|
@ -195,11 +195,7 @@ impl Drop for GlobalState {
|
|||
|
||||
impl GlobalStateSnapshot {
|
||||
pub(crate) fn url_to_file_id(&self, url: &Url) -> Result<FileId> {
|
||||
let path = from_proto::abs_path(url)?;
|
||||
let path = path.into();
|
||||
let res =
|
||||
self.vfs.read().0.file_id(&path).ok_or_else(|| format!("file not found: {}", path))?;
|
||||
Ok(res)
|
||||
url_to_file_id(&self.vfs.read().0, url)
|
||||
}
|
||||
|
||||
pub(crate) fn file_id_to_url(&self, id: FileId) -> Url {
|
||||
|
@ -239,3 +235,9 @@ pub(crate) fn file_id_to_url(vfs: &vfs::Vfs, id: FileId) -> Url {
|
|||
let path = path.as_path().unwrap();
|
||||
url_from_abs_path(&path)
|
||||
}
|
||||
|
||||
pub(crate) fn url_to_file_id(vfs: &vfs::Vfs, url: &Url) -> Result<FileId> {
|
||||
let path = from_proto::vfs_path(url)?;
|
||||
let res = vfs.file_id(&path).ok_or_else(|| format!("file not found: {}", path))?;
|
||||
Ok(res)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue