Skip to content

Commit e241015

Browse files
Rename is_member to is_local
1 parent 8a4c35a commit e241015

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

crates/project_model/src/cargo_workspace.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ pub struct PackageData {
135135
pub manifest: ManifestPath,
136136
/// Targets provided by the crate (lib, bin, example, test, ...)
137137
pub targets: Vec<Target>,
138-
/// Is this package a member of the current workspace
139-
pub is_member: bool,
138+
/// Does this package come from the local filesystem (and is editable)?
139+
pub is_local: bool,
140140
/// List of packages this package depends on
141141
pub dependencies: Vec<PackageDependency>,
142142
/// Rust edition for this package
@@ -308,15 +308,15 @@ impl CargoWorkspace {
308308
});
309309
// We treat packages without source as "local" packages. That includes all members of
310310
// the current workspace, as well as any path dependency outside the workspace.
311-
let is_member = meta_pkg.source.is_none();
311+
let is_local = meta_pkg.source.is_none();
312312

313313
let pkg = packages.alloc(PackageData {
314314
id: id.repr.clone(),
315315
name: name.clone(),
316316
version: version.clone(),
317317
manifest: AbsPathBuf::assert(PathBuf::from(&manifest_path)).try_into().unwrap(),
318318
targets: Vec::new(),
319-
is_member,
319+
is_local,
320320
edition,
321321
dependencies: Vec::new(),
322322
features: meta_pkg.features.clone().into_iter().collect(),

crates/project_model/src/workspace.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ impl CfgOverrides {
5353
/// the current workspace.
5454
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
5555
pub struct PackageRoot {
56-
/// Is a member of the current workspace
57-
pub is_member: bool,
56+
/// Is from the local filesystem and may be edited
57+
pub is_local: bool,
5858
pub include: Vec<AbsPathBuf>,
5959
pub exclude: Vec<AbsPathBuf>,
6060
}
@@ -268,15 +268,15 @@ impl ProjectWorkspace {
268268
ProjectWorkspace::Json { project, sysroot, rustc_cfg: _ } => project
269269
.crates()
270270
.map(|(_, krate)| PackageRoot {
271-
is_member: krate.is_workspace_member,
271+
is_local: krate.is_workspace_member,
272272
include: krate.include.clone(),
273273
exclude: krate.exclude.clone(),
274274
})
275275
.collect::<FxHashSet<_>>()
276276
.into_iter()
277277
.chain(sysroot.as_ref().into_iter().flat_map(|sysroot| {
278278
sysroot.crates().map(move |krate| PackageRoot {
279-
is_member: false,
279+
is_local: false,
280280
include: vec![sysroot[krate].root.parent().to_path_buf()],
281281
exclude: Vec::new(),
282282
})
@@ -293,7 +293,7 @@ impl ProjectWorkspace {
293293
cargo
294294
.packages()
295295
.map(|pkg| {
296-
let is_member = cargo[pkg].is_member;
296+
let is_local = cargo[pkg].is_local;
297297
let pkg_root = cargo[pkg].manifest.parent().to_path_buf();
298298

299299
let mut include = vec![pkg_root.clone()];
@@ -319,23 +319,23 @@ impl ProjectWorkspace {
319319
include.extend(extra_targets);
320320

321321
let mut exclude = vec![pkg_root.join(".git")];
322-
if is_member {
322+
if is_local {
323323
exclude.push(pkg_root.join("target"));
324324
} else {
325325
exclude.push(pkg_root.join("tests"));
326326
exclude.push(pkg_root.join("examples"));
327327
exclude.push(pkg_root.join("benches"));
328328
}
329-
PackageRoot { is_member, include, exclude }
329+
PackageRoot { is_local, include, exclude }
330330
})
331331
.chain(sysroot.into_iter().map(|sysroot| PackageRoot {
332-
is_member: false,
332+
is_local: false,
333333
include: vec![sysroot.root().to_path_buf()],
334334
exclude: Vec::new(),
335335
}))
336336
.chain(rustc.into_iter().flat_map(|rustc| {
337337
rustc.packages().map(move |krate| PackageRoot {
338-
is_member: false,
338+
is_local: false,
339339
include: vec![rustc[krate].manifest.parent().to_path_buf()],
340340
exclude: Vec::new(),
341341
})
@@ -345,12 +345,12 @@ impl ProjectWorkspace {
345345
ProjectWorkspace::DetachedFiles { files, sysroot, .. } => files
346346
.into_iter()
347347
.map(|detached_file| PackageRoot {
348-
is_member: true,
348+
is_local: true,
349349
include: vec![detached_file.clone()],
350350
exclude: Vec::new(),
351351
})
352352
.chain(sysroot.crates().map(|krate| PackageRoot {
353-
is_member: false,
353+
is_local: false,
354354
include: vec![sysroot[krate].root.parent().to_path_buf()],
355355
exclude: Vec::new(),
356356
}))

crates/rust-analyzer/src/reload.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ impl GlobalState {
294294
.workspaces
295295
.iter()
296296
.flat_map(|ws| ws.to_roots())
297-
.filter(|it| it.is_member)
297+
.filter(|it| it.is_local)
298298
.flat_map(|root| {
299299
root.include.into_iter().flat_map(|it| {
300300
[
@@ -514,12 +514,12 @@ impl ProjectFolders {
514514
vfs::loader::Entry::Directories(dirs)
515515
};
516516

517-
if root.is_member {
517+
if root.is_local {
518518
res.watch.push(res.load.len());
519519
}
520520
res.load.push(entry);
521521

522-
if root.is_member {
522+
if root.is_local {
523523
local_filesets.push(fsc.len());
524524
}
525525
fsc.add_file_set(file_set_roots)

0 commit comments

Comments
 (0)