Skip to content

cargo locate-project --workspace loads all the workspace #15107

@tkr-sh

Description

@tkr-sh

Problem

cargo locate-project --workspace loads all the workspace instead of just returning the path of the workspace root.

Steps

cargo locate-project --workspace

Possible Solution(s)

Instead of doing

src/bin/cargo/commands/locate_project.rs

WhatToFind::Workspace => {
    workspace = args.workspace(gctx)?;
    workspace.root_manifest()
}

I think that

WhatToFind::Workspace => {
    let root = args.root_manifest(gctx)?;
    let mut ws = Workspace::new_default(root.to_path_buf(), gctx);
    ws.target_dir = gctx.target_dir()?;
    ws.find_root(manifest_path)?
}

or something like that would be better. Because when in a big workspace with a lot of members in a workspace, it will load some unused data.

Metadata

Metadata

Assignees

Labels

C-bugCategory: bugCommand-locate-projectPerformanceGotta go fast!S-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or review

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions