]> git.lizzy.rs Git - rust.git/commitdiff
rename
authorAleksey Kladov <aleksey.kladov@gmail.com>
Tue, 6 Aug 2019 08:50:32 +0000 (10:50 +0200)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Tue, 6 Aug 2019 08:50:32 +0000 (10:50 +0200)
crates/ra_batch/src/lib.rs
crates/ra_batch/src/vfs_filter.rs
crates/ra_lsp_server/src/vfs_filter.rs
crates/ra_project_model/src/lib.rs

index c25737aaa8ef10111245846904783e7b9f95b80f..c01574fbc8ee261571af36ffe73288bcfcac3e49 100644 (file)
@@ -6,7 +6,7 @@
 
 use ra_db::{CrateGraph, FileId, SourceRootId};
 use ra_ide_api::{AnalysisChange, AnalysisHost};
-use ra_project_model::{ProjectRoot, ProjectWorkspace};
+use ra_project_model::{PackageRoot, ProjectWorkspace};
 use ra_vfs::{Vfs, VfsChange};
 use vfs_filter::IncludeRustFiles;
 
@@ -19,7 +19,7 @@ fn vfs_root_to_id(r: ra_vfs::VfsRoot) -> SourceRootId {
     SourceRootId(r.0)
 }
 
-pub fn load_cargo(root: &Path) -> Result<(AnalysisHost, FxHashMap<SourceRootId, ProjectRoot>)> {
+pub fn load_cargo(root: &Path) -> Result<(AnalysisHost, FxHashMap<SourceRootId, PackageRoot>)> {
     let root = std::env::current_dir()?.join(root);
     let ws = ProjectWorkspace::discover(root.as_ref())?;
     let project_roots = ws.to_roots();
@@ -48,7 +48,7 @@ pub fn load_cargo(root: &Path) -> Result<(AnalysisHost, FxHashMap<SourceRootId,
 }
 
 pub fn load(
-    source_roots: &FxHashMap<SourceRootId, ProjectRoot>,
+    source_roots: &FxHashMap<SourceRootId, PackageRoot>,
     crate_graph: CrateGraph,
     vfs: &mut Vfs,
 ) -> AnalysisHost {
index 2f0d8cb8b71669957004ba65c86e34f6a2193da4..63bf77704ad9aa689862d748185c09c5bed3afa8 100644 (file)
@@ -1,32 +1,32 @@
-use ra_project_model::ProjectRoot;
+use ra_project_model::PackageRoot;
 use ra_vfs::{Filter, RelativePath, RootEntry};
 use std::path::PathBuf;
 
 /// `IncludeRustFiles` is used to convert
-/// from `ProjectRoot` to `RootEntry` for VFS
+/// from `PackageRoot` to `RootEntry` for VFS
 pub struct IncludeRustFiles {
-    root: ProjectRoot,
+    root: PackageRoot,
 }
 
 impl IncludeRustFiles {
     pub fn from_roots<R>(roots: R) -> impl Iterator<Item = RootEntry>
     where
-        R: IntoIterator<Item = ProjectRoot>,
+        R: IntoIterator<Item = PackageRoot>,
     {
         roots.into_iter().map(IncludeRustFiles::from_root)
     }
 
-    pub fn from_root(root: ProjectRoot) -> RootEntry {
+    pub fn from_root(root: PackageRoot) -> RootEntry {
         IncludeRustFiles::from(root).into()
     }
 
     #[allow(unused)]
     pub fn external(path: PathBuf) -> RootEntry {
-        IncludeRustFiles::from_root(ProjectRoot::new(path, false))
+        IncludeRustFiles::from_root(PackageRoot::new(path, false))
     }
 
     pub fn member(path: PathBuf) -> RootEntry {
-        IncludeRustFiles::from_root(ProjectRoot::new(path, true))
+        IncludeRustFiles::from_root(PackageRoot::new(path, true))
     }
 }
 
@@ -40,8 +40,8 @@ fn include_file(&self, file_path: &RelativePath) -> bool {
     }
 }
 
-impl From<ProjectRoot> for IncludeRustFiles {
-    fn from(v: ProjectRoot) -> IncludeRustFiles {
+impl From<PackageRoot> for IncludeRustFiles {
+    fn from(v: PackageRoot) -> IncludeRustFiles {
         IncludeRustFiles { root: v }
     }
 }
index e16a57da56759f18ee688e6be8b5a3327d99af9f..abdc8dbad2405200ce4af4a8c4c8027e9b44d9d8 100644 (file)
@@ -1,32 +1,32 @@
-use ra_project_model::ProjectRoot;\r
+use ra_project_model::PackageRoot;\r
 use ra_vfs::{Filter, RelativePath, RootEntry};\r
 use std::path::PathBuf;\r
 \r
 /// `IncludeRustFiles` is used to convert\r
-/// from `ProjectRoot` to `RootEntry` for VFS\r
+/// from `PackageRoot` to `RootEntry` for VFS\r
 pub struct IncludeRustFiles {\r
-    root: ProjectRoot,\r
+    root: PackageRoot,\r
 }\r
 \r
 impl IncludeRustFiles {\r
     pub fn from_roots<R>(roots: R) -> impl Iterator<Item = RootEntry>\r
     where\r
-        R: IntoIterator<Item = ProjectRoot>,\r
+        R: IntoIterator<Item = PackageRoot>,\r
     {\r
         roots.into_iter().map(IncludeRustFiles::from_root)\r
     }\r
 \r
-    pub fn from_root(root: ProjectRoot) -> RootEntry {\r
+    pub fn from_root(root: PackageRoot) -> RootEntry {\r
         IncludeRustFiles::from(root).into()\r
     }\r
 \r
     #[allow(unused)]\r
     pub fn external(path: PathBuf) -> RootEntry {\r
-        IncludeRustFiles::from_root(ProjectRoot::new(path, false))\r
+        IncludeRustFiles::from_root(PackageRoot::new(path, false))\r
     }\r
 \r
     pub fn member(path: PathBuf) -> RootEntry {\r
-        IncludeRustFiles::from_root(ProjectRoot::new(path, true))\r
+        IncludeRustFiles::from_root(PackageRoot::new(path, true))\r
     }\r
 }\r
 \r
@@ -40,8 +40,8 @@ fn include_file(&self, file_path: &RelativePath) -> bool {
     }\r
 }\r
 \r
-impl std::convert::From<ProjectRoot> for IncludeRustFiles {\r
-    fn from(v: ProjectRoot) -> IncludeRustFiles {\r
+impl std::convert::From<PackageRoot> for IncludeRustFiles {\r
+    fn from(v: PackageRoot) -> IncludeRustFiles {\r
         IncludeRustFiles { root: v }\r
     }\r
 }\r
index 08e5c1c325c9f527faf4571856b4ddf988f7b7d2..647a1f36585b2bd07cab3daf02476b946e925f97 100644 (file)
@@ -34,20 +34,20 @@ pub enum ProjectWorkspace {
     Json { project: JsonProject },
 }
 
-/// `ProjectRoot` describes a workspace root folder.
+/// `PackageRoot` describes a package root folder.
 /// Which may be an external dependency, or a member of
 /// the current workspace.
 #[derive(Clone)]
-pub struct ProjectRoot {
+pub struct PackageRoot {
     /// Path to the root folder
     path: PathBuf,
     /// Is a member of the current workspace
     is_member: bool,
 }
 
-impl ProjectRoot {
-    pub fn new(path: PathBuf, is_member: bool) -> ProjectRoot {
-        ProjectRoot { path, is_member }
+impl PackageRoot {
+    pub fn new(path: PathBuf, is_member: bool) -> PackageRoot {
+        PackageRoot { path, is_member }
     }
 
     pub fn path(&self) -> &PathBuf {
@@ -99,15 +99,15 @@ pub fn discover(path: &Path) -> Result<ProjectWorkspace> {
         }
     }
 
-    /// Returns the roots for the current ProjectWorkspace
+    /// Returns the roots for the current `ProjectWorkspace`
     /// The return type contains the path and whether or not
     /// the root is a member of the current workspace
-    pub fn to_roots(&self) -> Vec<ProjectRoot> {
+    pub fn to_roots(&self) -> Vec<PackageRoot> {
         match self {
             ProjectWorkspace::Json { project } => {
                 let mut roots = Vec::with_capacity(project.roots.len());
                 for root in &project.roots {
-                    roots.push(ProjectRoot::new(root.path.clone(), true));
+                    roots.push(PackageRoot::new(root.path.clone(), true));
                 }
                 roots
             }
@@ -117,10 +117,10 @@ pub fn to_roots(&self) -> Vec<ProjectRoot> {
                 for pkg in cargo.packages() {
                     let root = pkg.root(&cargo).to_path_buf();
                     let member = pkg.is_member(&cargo);
-                    roots.push(ProjectRoot::new(root, member));
+                    roots.push(PackageRoot::new(root, member));
                 }
                 for krate in sysroot.crates() {
-                    roots.push(ProjectRoot::new(krate.root_dir(&sysroot).to_path_buf(), false))
+                    roots.push(PackageRoot::new(krate.root_dir(&sysroot).to_path_buf(), false))
                 }
                 roots
             }