⬆️ rust-analyzer

Merge commit '368e0bb32f'
This commit is contained in:
arcnmx 2023-01-09 10:36:22 -08:00
parent b3ef934ccb
commit 25242fe93f
395 changed files with 14569 additions and 5755 deletions

View file

@ -140,16 +140,11 @@ impl FileSetConfig {
}
/// Builder for [`FileSetConfig`].
#[derive(Default)]
pub struct FileSetConfigBuilder {
roots: Vec<Vec<VfsPath>>,
}
impl Default for FileSetConfigBuilder {
fn default() -> Self {
FileSetConfigBuilder { roots: Vec::new() }
}
}
impl FileSetConfigBuilder {
/// Returns the number of sets currently held.
pub fn len(&self) -> usize {

View file

@ -59,15 +59,10 @@ pub use paths::{AbsPath, AbsPathBuf};
/// Handle to a file in [`Vfs`]
///
/// Most functions in rust-analyzer use this when they need to refer to a file.
#[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq)]
#[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Hash)]
pub struct FileId(pub u32);
impl stdx::hash::NoHashHashable for FileId {}
impl std::hash::Hash for FileId {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.0.hash(state);
}
}
/// Storage for all files read by rust-analyzer.
///

View file

@ -9,16 +9,11 @@ use rustc_hash::FxHasher;
use crate::{FileId, VfsPath};
/// Structure to map between [`VfsPath`] and [`FileId`].
#[derive(Default)]
pub(crate) struct PathInterner {
map: IndexSet<VfsPath, BuildHasherDefault<FxHasher>>,
}
impl Default for PathInterner {
fn default() -> Self {
Self { map: IndexSet::default() }
}
}
impl PathInterner {
/// Get the id corresponding to `path`.
///

View file

@ -364,7 +364,7 @@ impl VirtualPath {
path = &path["../".len()..];
}
path = path.trim_start_matches("./");
res.0 = format!("{}/{}", res.0, path);
res.0 = format!("{}/{path}", res.0);
Some(res)
}