File tree Expand file tree Collapse file tree 4 files changed +17
-9
lines changed Expand file tree Collapse file tree 4 files changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -492,7 +492,7 @@ pub fn cli() -> Command {
492492 let usage = if is_rustup {
493493 "cargo [+toolchain] [OPTIONS] [COMMAND]\n cargo [+toolchain] [OPTIONS] -Zscript <MANIFEST_RS> [ARGS]..."
494494 } else {
495- "cargo [OPTIONS] [COMMAND]\n cargo [OPTIONS] -Zscript <MANIFEST_RS > [ARGS]..."
495+ "cargo [OPTIONS] [COMMAND]\n cargo [OPTIONS] -Zscript <MANIFEST > [ARGS]..."
496496 } ;
497497 Command :: new ( "cargo" )
498498 // Subcommands all count their args' display order independently (from 0),
Original file line number Diff line number Diff line change @@ -87,7 +87,9 @@ pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
8787
8888pub fn is_manifest_command ( arg : & str ) -> bool {
8989 let path = Path :: new ( arg) ;
90- 1 < path. components ( ) . count ( ) || path. extension ( ) == Some ( OsStr :: new ( "rs" ) )
90+ 1 < path. components ( ) . count ( )
91+ || path. extension ( ) == Some ( OsStr :: new ( "rs" ) )
92+ || path. file_name ( ) == Some ( OsStr :: new ( "Cargo.toml" ) )
9193}
9294
9395pub fn exec_manifest_command ( config : & Config , cmd : & str , args : & [ OsString ] ) -> CliResult {
Original file line number Diff line number Diff line change @@ -1462,16 +1462,19 @@ persistent lockfile.
14621462
14631463#### Manifest-commands
14641464
1465- You may pass single-file packages directly to the ` cargo ` command, without subcommand. This is mostly intended for being put in ` #! ` lines.
1465+ You may pass a manifest directly to the ` cargo ` command, without a subcommand,
1466+ like ` foo/Cargo.toml ` or a single-file package like ` foo.rs ` . This is mostly
1467+ intended for being put in ` #! ` lines.
14661468
14671469The precedence for how to interpret ` cargo <subcommand> ` is
146814701 . Built-in xor single-file packages
146914712 . Aliases
147014723 . External subcommands
14711473
1472- A parameter is identified as a single-file package if it has one of:
1474+ A parameter is identified as a manifest-command if it has one of:
14731475- Path separators
14741476- A ` .rs ` extension
1477+ - The file name is ` Cargo.toml `
14751478
14761479### ` [lints] `
14771480
Original file line number Diff line number Diff line change @@ -73,13 +73,16 @@ fn basic_cargo_toml() {
7373
7474 p. cargo ( "-Zscript Cargo.toml" )
7575 . masquerade_as_nightly_cargo ( & [ "script" ] )
76- . with_status ( 101 )
77- . with_stdout ( "" )
76+ . with_stdout (
77+ r#"bin: target/debug/foo[EXE]
78+ args: []
79+ "# ,
80+ )
7881 . with_stderr (
7982 "\
80- error: no such command: `Cargo.toml`
81-
82- <tab>View all installed commands with `cargo --list `
83+ [COMPILING] foo v0.0.1 ([ROOT]/foo)
84+ [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
85+ [RUNNING] `target/debug/foo[EXE] `
8386" ,
8487 )
8588 . run ( ) ;
You can’t perform that action at this time.
0 commit comments