File tree Expand file tree Collapse file tree 4 files changed +12
-3
lines changed
Expand file tree Collapse file tree 4 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -236,6 +236,7 @@ supported. Git/path dependencies will be ignored.
236236
237237All packages in the workspace will be upgraded if the `--workspace` flag is supplied.
238238The `--workspace` flag may be supplied in the presence of a virtual manifest.
239+ Running in workspace root automatically implies `--workspace`
239240
240241If the '--to-lockfile' flag is supplied, all dependencies will be upgraded to the currently locked
241242version as recorded in the Cargo.lock file. This flag requires that the Cargo.lock file is
Original file line number Diff line number Diff line change @@ -75,7 +75,8 @@ fn process(args: Args) -> Result<()> {
7575 if all {
7676 deprecated_message ( "The flag `--all` has been deprecated in favor of `--workspace`" ) ?;
7777 }
78- let all = workspace || all;
78+ let all = workspace || all || LocalManifest :: find ( & None ) ?. is_virtual ( ) ;
79+
7980 let manifests = if all {
8081 Manifests :: get_all ( & manifest_path)
8182 } else if let Some ( ref pkgid) = pkgid {
Original file line number Diff line number Diff line change @@ -94,6 +94,7 @@ struct Args {
9494 all : bool ,
9595
9696 /// Upgrade all packages in the workspace.
97+ /// Implied by default when running in a directory with virtual manifest.
9798 #[ structopt( long = "workspace" , conflicts_with = "all" , conflicts_with = "pkgid" ) ]
9899 workspace : bool ,
99100
@@ -468,7 +469,8 @@ fn process(args: Args) -> Result<()> {
468469 deprecated_message ( "The flag `--all` has been deprecated in favor of `--workspace`" ) ?;
469470 }
470471
471- let all = workspace || all;
472+ // Running in workspace root automatically implies `--workspace`
473+ let all = workspace || all || LocalManifest :: find ( & None ) ?. is_virtual ( ) ;
472474
473475 if !args. offline && !to_lockfile && std:: env:: var ( "CARGO_IS_TEST" ) . is_err ( ) {
474476 let url = registry_url ( & find ( & manifest_path) ?, None ) ?;
Original file line number Diff line number Diff line change @@ -293,10 +293,15 @@ impl LocalManifest {
293293 Ok ( LocalManifest { manifest, path } )
294294 }
295295
296+ /// Check if local manifest is virtual, i. e. corresponds to workspace root
297+ pub fn is_virtual ( & self ) -> bool {
298+ !self . data [ "workspace" ] . is_none ( )
299+ }
300+
296301 /// Write changes back to the file
297302 pub fn write ( & self ) -> Result < ( ) > {
298303 if self . manifest . data [ "package" ] . is_none ( ) && self . manifest . data [ "project" ] . is_none ( ) {
299- if ! self . manifest . data [ "workspace" ] . is_none ( ) {
304+ if self . is_virtual ( ) {
300305 return Err ( ErrorKind :: UnexpectedRootManifest . into ( ) ) ;
301306 } else {
302307 return Err ( ErrorKind :: InvalidManifest . into ( ) ) ;
You can’t perform that action at this time.
0 commit comments