Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(toml): Warn on unused workspace.dependencies keys on virtual workspaces #13664

Merged
merged 12 commits into from
Mar 28, 2024
Merged
6 changes: 6 additions & 0 deletions src/cargo/core/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ pub enum EitherManifest {
}

impl EitherManifest {
pub fn warnings_mut(&mut self) -> &mut Warnings {
match self {
EitherManifest::Real(r) => r.warnings_mut(),
EitherManifest::Virtual(v) => v.warnings_mut(),
}
}
pub(crate) fn workspace_config(&self) -> &WorkspaceConfig {
match *self {
EitherManifest::Real(ref r) => r.workspace_config(),
Expand Down
4 changes: 4 additions & 0 deletions src/cargo/ops/cargo_package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,13 +458,17 @@ fn build_lock(ws: &Workspace<'_>, orig_pkg: &Package) -> CargoResult<String> {
let toml_manifest =
prepare_for_publish(orig_pkg.manifest().resolved_toml(), ws, orig_pkg.root())?;
let source_id = orig_pkg.package_id().source_id();
let mut warnings = Default::default();
let mut errors = Default::default();
Comment on lines +461 to +462
Copy link
Member

Choose a reason for hiding this comment

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

nit: Default::default is used here and in read_manifest we use vec![]. Any reason for the inconsistency?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not really but this will be going away in the next PR

let manifest = to_real_manifest(
contents.to_owned(),
document.clone(),
toml_manifest,
source_id,
orig_pkg.manifest_path(),
gctx,
&mut warnings,
&mut errors,
)?;
let new_pkg = Package::new(manifest, orig_pkg.manifest_path());

Expand Down
Loading