Commit 125eeca 1 parent a1525bc commit 125eeca Copy full SHA for 125eeca
File tree 2 files changed +21
-8
lines changed
2 files changed +21
-8
lines changed Original file line number Diff line number Diff line change @@ -1507,7 +1507,7 @@ impl Config {
1507
1507
let possible_with_extension = dir. join ( format ! ( "{}.toml" , filename_without_extension) ) ;
1508
1508
1509
1509
if possible. exists ( ) {
1510
- if warn && possible_with_extension . exists ( ) {
1510
+ if warn {
1511
1511
// We don't want to print a warning if the version
1512
1512
// without the extension is just a symlink to the version
1513
1513
// WITH an extension, which people may want to do to
@@ -1520,12 +1520,22 @@ impl Config {
1520
1520
} ;
1521
1521
1522
1522
if !skip_warning {
1523
- self . shell ( ) . warn ( format ! (
1524
- "Both `{}` and `{}` exist. Using `{}`" ,
1525
- possible. display( ) ,
1526
- possible_with_extension. display( ) ,
1527
- possible. display( )
1528
- ) ) ?;
1523
+ if possible_with_extension. exists ( ) {
1524
+ self . shell ( ) . warn ( format ! (
1525
+ "Both `{}` and `{}` exist. Using `{}`" ,
1526
+ possible. display( ) ,
1527
+ possible_with_extension. display( ) ,
1528
+ possible. display( )
1529
+ ) ) ?;
1530
+ } else {
1531
+ self . shell ( ) . warn ( format ! (
1532
+ "`{}` is deprecated in favor of `{filename_without_extension}.toml`" ,
1533
+ possible. display( ) ,
1534
+ ) ) ?;
1535
+ self . shell ( ) . note (
1536
+ format ! ( "If you need to support cargo 1.38 or earlier, you can symlink `{filename_without_extension}.toml` to `{filename_without_extension}`" ) ,
1537
+ ) ?;
1538
+ }
1529
1539
}
1530
1540
}
1531
1541
Original file line number Diff line number Diff line change @@ -275,7 +275,10 @@ f1 = 1
275
275
276
276
// It should NOT have warned for the symlink.
277
277
let output = read_output ( config) ;
278
- assert_match ( "" , & output) ;
278
+ let expected = "\
279
+ warning: `[ROOT]/.cargo/config` is deprecated in favor of `config.toml`
280
+ note: If you need to support cargo 1.38 or earlier, you can symlink `config.toml` to `config`" ;
281
+ assert_match ( expected, & output) ;
279
282
}
280
283
281
284
#[ cargo_test]
You can’t perform that action at this time.
0 commit comments