File tree 4 files changed +17
-9
lines changed
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 {
492
492
let usage = if is_rustup {
493
493
"cargo [+toolchain] [OPTIONS] [COMMAND]\n cargo [+toolchain] [OPTIONS] -Zscript <MANIFEST_RS> [ARGS]..."
494
494
} else {
495
- "cargo [OPTIONS] [COMMAND]\n cargo [OPTIONS] -Zscript <MANIFEST_RS > [ARGS]..."
495
+ "cargo [OPTIONS] [COMMAND]\n cargo [OPTIONS] -Zscript <MANIFEST > [ARGS]..."
496
496
} ;
497
497
Command :: new ( "cargo" )
498
498
// 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 {
87
87
88
88
pub fn is_manifest_command ( arg : & str ) -> bool {
89
89
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" ) )
91
93
}
92
94
93
95
pub 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.
1462
1462
1463
1463
#### Manifest-commands
1464
1464
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.
1466
1468
1467
1469
The precedence for how to interpret ` cargo <subcommand> ` is
1468
1470
1 . Built-in xor single-file packages
1469
1471
2 . Aliases
1470
1472
3 . External subcommands
1471
1473
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:
1473
1475
- Path separators
1474
1476
- A ` .rs ` extension
1477
+ - The file name is ` Cargo.toml `
1475
1478
1476
1479
### ` [lints] `
1477
1480
Original file line number Diff line number Diff line change @@ -73,13 +73,16 @@ fn basic_cargo_toml() {
73
73
74
74
p. cargo ( "-Zscript Cargo.toml" )
75
75
. 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
+ )
78
81
. with_stderr (
79
82
"\
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] `
83
86
" ,
84
87
)
85
88
. run ( ) ;
You can’t perform that action at this time.
0 commit comments