Skip to content
5 changes: 3 additions & 2 deletions src/bin/cargo/commands/fix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ pub fn exec(gctx: &mut GlobalContext, args: &ArgMatches) -> CliResult {
let mut ws = Workspace::new(&root_manifest, gctx)?;
ws.set_resolve_honors_rust_version(args.honor_rust_version());
let lockfile_path = args.lockfile_path(gctx)?;
ws.set_requested_lockfile_path(lockfile_path.clone());
if ws.requested_lockfile_path().is_none() {
ws.set_requested_lockfile_path(lockfile_path.clone());
}

let mut opts =
args.compile_options(gctx, intent, Some(&ws), ProfileChecking::LegacyTestOnly)?;
Expand All @@ -102,7 +104,6 @@ pub fn exec(gctx: &mut GlobalContext, args: &ArgMatches) -> CliResult {
allow_staged: allow_dirty || args.flag("allow-staged"),
allow_no_vcs: args.flag("allow-no-vcs"),
broken_code: args.flag("broken-code"),
requested_lockfile_path: lockfile_path,
};

if let Some(fe) = &gctx.cli_unstable().fix_edition {
Expand Down
4 changes: 3 additions & 1 deletion src/cargo/ops/cargo_install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,9 @@ fn make_ws_rustc_target<'gctx>(
};
ws.set_resolve_feature_unification(FeatureUnification::Selected);
ws.set_ignore_lock(gctx.lock_update_allowed());
ws.set_requested_lockfile_path(lockfile_path.map(|p| p.to_path_buf()));
if ws.requested_lockfile_path().is_none() {
ws.set_requested_lockfile_path(lockfile_path.map(|p| p.to_path_buf()));
}
// if --lockfile-path is set, imply --locked
if ws.requested_lockfile_path().is_some() {
ws.set_ignore_lock(false);
Expand Down
1 change: 0 additions & 1 deletion src/cargo/ops/fix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ pub struct FixOptions {
pub allow_no_vcs: bool,
pub allow_staged: bool,
pub broken_code: bool,
pub requested_lockfile_path: Option<PathBuf>,
}

/// The behavior of `--edition` migration.
Expand Down
Loading