Skip to content

[ra_ap_load_cargo] Use std::fs::canonicalize() instead of std::env::current_dir()?.join(..) #19386

@snprajwal

Description

@snprajwal

In ra_ap_load_cargo::load_workspace_at():

let root = AbsPathBuf::assert_utf8(std::env::current_dir()?.join(root));
let root = ProjectManifest::discover_single(&root)?;
let manifest_path = root.manifest_path().clone();
let mut workspace = ProjectWorkspace::load(root, cargo_config, progress)?;

We are doing std::env::current_dir()?.join(root) assuming that the path being supplied is relative to the current directory. root.as_ref().canonicalize()? achieves the same thing, but also allows absolute paths to be passed into the function by external consumers of the library API. I think this is a nice improvement that does not break behaviour (as far as I can see). Happy to send a patch if acceptable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions