aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_project_model
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_project_model')
-rw-r--r--crates/ra_project_model/src/lib.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/crates/ra_project_model/src/lib.rs b/crates/ra_project_model/src/lib.rs
index 08e5c1c32..647a1f365 100644
--- a/crates/ra_project_model/src/lib.rs
+++ b/crates/ra_project_model/src/lib.rs
@@ -34,20 +34,20 @@ pub enum ProjectWorkspace {
34 Json { project: JsonProject }, 34 Json { project: JsonProject },
35} 35}
36 36
37/// `ProjectRoot` describes a workspace root folder. 37/// `PackageRoot` describes a package root folder.
38/// Which may be an external dependency, or a member of 38/// Which may be an external dependency, or a member of
39/// the current workspace. 39/// the current workspace.
40#[derive(Clone)] 40#[derive(Clone)]
41pub struct ProjectRoot { 41pub struct PackageRoot {
42 /// Path to the root folder 42 /// Path to the root folder
43 path: PathBuf, 43 path: PathBuf,
44 /// Is a member of the current workspace 44 /// Is a member of the current workspace
45 is_member: bool, 45 is_member: bool,
46} 46}
47 47
48impl ProjectRoot { 48impl PackageRoot {
49 pub fn new(path: PathBuf, is_member: bool) -> ProjectRoot { 49 pub fn new(path: PathBuf, is_member: bool) -> PackageRoot {
50 ProjectRoot { path, is_member } 50 PackageRoot { path, is_member }
51 } 51 }
52 52
53 pub fn path(&self) -> &PathBuf { 53 pub fn path(&self) -> &PathBuf {
@@ -99,15 +99,15 @@ impl ProjectWorkspace {
99 } 99 }
100 } 100 }
101 101
102 /// Returns the roots for the current ProjectWorkspace 102 /// Returns the roots for the current `ProjectWorkspace`
103 /// The return type contains the path and whether or not 103 /// The return type contains the path and whether or not
104 /// the root is a member of the current workspace 104 /// the root is a member of the current workspace
105 pub fn to_roots(&self) -> Vec<ProjectRoot> { 105 pub fn to_roots(&self) -> Vec<PackageRoot> {
106 match self { 106 match self {
107 ProjectWorkspace::Json { project } => { 107 ProjectWorkspace::Json { project } => {
108 let mut roots = Vec::with_capacity(project.roots.len()); 108 let mut roots = Vec::with_capacity(project.roots.len());
109 for root in &project.roots { 109 for root in &project.roots {
110 roots.push(ProjectRoot::new(root.path.clone(), true)); 110 roots.push(PackageRoot::new(root.path.clone(), true));
111 } 111 }
112 roots 112 roots
113 } 113 }
@@ -117,10 +117,10 @@ impl ProjectWorkspace {
117 for pkg in cargo.packages() { 117 for pkg in cargo.packages() {
118 let root = pkg.root(&cargo).to_path_buf(); 118 let root = pkg.root(&cargo).to_path_buf();
119 let member = pkg.is_member(&cargo); 119 let member = pkg.is_member(&cargo);
120 roots.push(ProjectRoot::new(root, member)); 120 roots.push(PackageRoot::new(root, member));
121 } 121 }
122 for krate in sysroot.crates() { 122 for krate in sysroot.crates() {
123 roots.push(ProjectRoot::new(krate.root_dir(&sysroot).to_path_buf(), false)) 123 roots.push(PackageRoot::new(krate.root_dir(&sysroot).to_path_buf(), false))
124 } 124 }
125 roots 125 roots
126 } 126 }