mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-25 11:14:46 +00:00
fix(workspace): reload current manifest only
This commit is contained in:
parent
f22b84f8d4
commit
304a7a0748
@ -306,7 +306,7 @@ impl<'gctx> Workspace<'gctx> {
|
||||
/// This is useful if the workspace has been updated, such as with `cargo
|
||||
/// fix` modifying the `Cargo.toml` file.
|
||||
pub fn reload(&self, gctx: &'gctx GlobalContext) -> CargoResult<Workspace<'gctx>> {
|
||||
let mut ws = Workspace::new(self.root_manifest(), gctx)?;
|
||||
let mut ws = Workspace::new(&self.current_manifest, gctx)?;
|
||||
ws.set_resolve_honors_rust_version(Some(self.resolve_honors_rust_version));
|
||||
ws.set_resolve_feature_unification(self.resolve_feature_unification);
|
||||
ws.set_requested_lockfile_path(self.requested_lockfile_path.clone());
|
||||
|
@ -2719,7 +2719,7 @@ fn nonexistence_package_together_with_workspace() {
|
||||
|
||||
// A failing case from <https://github.com/rust-lang/cargo/issues/15625>
|
||||
#[cargo_test]
|
||||
fn clippy_fix_all_members_in_a_workspace() {
|
||||
fn fix_only_check_manifest_path_member() {
|
||||
let p = project()
|
||||
.file(
|
||||
"Cargo.toml",
|
||||
@ -2751,8 +2751,11 @@ fn clippy_fix_all_members_in_a_workspace() {
|
||||
.file("bar/src/main.rs", "fn main() {}")
|
||||
.build();
|
||||
|
||||
p.cargo("clippy --manifest-path foo/Cargo.toml --fix --allow-no-vcs")
|
||||
.with_stderr_contains("[CHECKING] foo v0.1.0 ([ROOT]/foo/foo)")
|
||||
.with_stderr_contains("[CHECKING] bar v0.1.0 ([ROOT]/foo/bar)")
|
||||
p.cargo("fix --manifest-path foo/Cargo.toml --allow-no-vcs")
|
||||
.with_stderr_data(str![[r#"
|
||||
[CHECKING] foo v0.1.0 ([ROOT]/foo/foo)
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user