Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ use toml_edit::{DocumentMut, Item, Table, TomlError};
pub enum Error {
NotFound(PathBuf),
CargoManifestDirNotSet,
CargoEnvVariableNotSet,
FailedGettingWorkspaceManifestPath,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
FailedGettingWorkspaceManifestPath,
#[deprecated]
CargoEnvVariableNotSet,
FailedGettingWorkspaceManifestPath,

CouldNotRead { path: PathBuf, source: io::Error },
InvalidToml { source: TomlError },
Expand Down Expand Up @@ -138,7 +137,6 @@ impl fmt::Display for Error {
crate_name,
path.display(),
),
Error::CargoEnvVariableNotSet => f.write_str("`CARGO` env variable not set."),
Error::FailedGettingWorkspaceManifestPath =>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Error::FailedGettingWorkspaceManifestPath =>
#[allow(deprecated)]
Error::CargoEnvVariableNotSet => f.write_str("`CARGO` env variable not set."),
Error::FailedGettingWorkspaceManifestPath =>

f.write_str("Failed to get the path of the workspace manifest path."),
}
Expand Down Expand Up @@ -241,7 +239,11 @@ pub fn crate_name(orig_name: &str) -> Result<FoundCrate, Error> {
}

fn workspace_manifest_path(cargo_toml_manifest: &Path) -> Result<Option<PathBuf>, Error> {
let stdout = Command::new(env::var("CARGO").map_err(|_| Error::CargoEnvVariableNotSet)?)
let Ok(cargo) = env::var("CARGO") else {
return Ok(None);
};

let stdout = Command::new(cargo)
.arg("locate-project")
.args(&["--workspace", "--message-format=plain"])
.arg(format!("--manifest-path={}", cargo_toml_manifest.display()))
Expand Down
Loading