mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
remove dead code
This commit is contained in:
parent
7f9a6521ef
commit
154bce1864
3 changed files with 2 additions and 35 deletions
|
@ -2,7 +2,6 @@
|
|||
mod cancellation;
|
||||
mod input;
|
||||
mod loc2id;
|
||||
pub mod mock;
|
||||
|
||||
use std::{
|
||||
panic, sync::Arc,
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
use rustc_hash::FxHashSet;
|
||||
use relative_path::{RelativePath, RelativePathBuf};
|
||||
|
||||
use crate::{FileId};
|
||||
|
||||
#[derive(Default, Debug, Clone)]
|
||||
pub struct FileMap(Vec<(FileId, RelativePathBuf)>);
|
||||
|
||||
impl FileMap {
|
||||
pub fn add(&mut self, path: RelativePathBuf) -> FileId {
|
||||
let file_id = FileId((self.0.len() + 1) as u32);
|
||||
self.0.push((file_id, path));
|
||||
file_id
|
||||
}
|
||||
|
||||
pub fn files(&self) -> FxHashSet<FileId> {
|
||||
self.iter().map(|(id, _)| id).collect()
|
||||
}
|
||||
|
||||
pub fn file_id(&self, path: &str) -> FileId {
|
||||
assert!(path.starts_with('/'));
|
||||
self.iter().find(|(_, p)| p == &path[1..]).unwrap().0
|
||||
}
|
||||
|
||||
fn iter<'a>(&'a self) -> impl Iterator<Item = (FileId, &'a RelativePath)> + 'a {
|
||||
self.0
|
||||
.iter()
|
||||
.map(|(id, path)| (*id, path.as_relative_path()))
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue