Migrate to privacy as per review commets

This commit is contained in:
veetaha
2020-04-01 13:40:40 +03:00
parent bef899aa78
commit 6190caeeae
6 changed files with 25 additions and 15 deletions

View File

@@ -65,10 +65,10 @@ pub fn analysis_bench(
roots
.iter()
.find_map(|(source_root_id, project_root)| {
if project_root.is_member {
if project_root.is_member() {
for file_id in db.source_root(*source_root_id).walk() {
let rel_path = db.file_relative_path(file_id);
let abs_path = rel_path.to_path(&project_root.path);
let abs_path = rel_path.to_path(project_root.path());
if abs_path == path {
return Some(file_id);
}

View File

@@ -39,7 +39,7 @@ pub fn analysis_stats(
roots
.into_iter()
.filter_map(|(source_root_id, project_root)| {
if with_deps || project_root.is_member {
if with_deps || project_root.is_member() {
Some(source_root_id)
} else {
None

View File

@@ -45,9 +45,9 @@ pub(crate) fn load_cargo(
.iter()
.map(|pkg_root| {
RootEntry::new(
pkg_root.path.clone(),
pkg_root.path().to_owned(),
RustPackageFilterBuilder::default()
.set_member(pkg_root.is_member)
.set_member(pkg_root.is_member())
.into_vfs_filter(),
)
})
@@ -60,8 +60,11 @@ pub(crate) fn load_cargo(
.into_iter()
.map(|vfs_root| {
let source_root_id = vfs_root_to_id(vfs_root);
let project_root =
project_roots.iter().find(|it| it.path == vfs.root2path(vfs_root)).unwrap().clone();
let project_root = project_roots
.iter()
.find(|it| it.path() == vfs.root2path(vfs_root))
.unwrap()
.clone();
(source_root_id, project_root)
})
.collect::<FxHashMap<_, _>>();
@@ -93,7 +96,7 @@ pub(crate) fn load(
match change {
VfsChange::AddRoot { root, files } => {
let source_root_id = vfs_root_to_id(root);
let is_local = source_roots[&source_root_id].is_member;
let is_local = source_roots[&source_root_id].is_member();
log::debug!(
"loaded source root {:?} with path {:?}",
source_root_id,
@@ -102,7 +105,7 @@ pub(crate) fn load(
analysis_change.add_root(source_root_id, is_local);
analysis_change.set_debug_root_path(
source_root_id,
source_roots[&source_root_id].path.display().to_string(),
source_roots[&source_root_id].path().display().to_string(),
);
let vfs_root_path = vfs.root2path(root);