File tree Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -452,7 +452,7 @@ impl Config {
452
452
} else if let Some ( dir) = env:: var_os ( "CARGO_TARGET_DIR" ) {
453
453
// Check if the CARGO_TARGET_DIR environment variable is set to an empty string.
454
454
if dir. to_string_lossy ( ) == "" {
455
- anyhow:: bail!( "the target directory is set to an empty string in the CARGO_TARGET_DIR environment variable. " )
455
+ anyhow:: bail!( "the target directory is set to an empty string in the ` CARGO_TARGET_DIR` environment variable" )
456
456
}
457
457
458
458
Ok ( Some ( Filesystem :: new ( self . cwd . join ( dir) ) ) )
@@ -461,9 +461,10 @@ impl Config {
461
461
462
462
// Check if the target directory is set to an empty string in the config.toml file.
463
463
if val. raw_value ( ) == "" {
464
- anyhow:: bail!(
465
- "the target directory is set to an empty string in the config.toml file." ,
466
- )
464
+ anyhow:: bail!( format!(
465
+ "the target directory is set to an empty string in {}" ,
466
+ val. value( ) . definition
467
+ ) , )
467
468
}
468
469
469
470
Ok ( Some ( Filesystem :: new ( path) ) )
Original file line number Diff line number Diff line change @@ -10,6 +10,11 @@ use std::path::PathBuf;
10
10
pub struct ConfigRelativePath ( Value < String > ) ;
11
11
12
12
impl ConfigRelativePath {
13
+ /// Returns the underlying value.
14
+ pub fn value ( & self ) -> & Value < String > {
15
+ & self . 0
16
+ }
17
+
13
18
/// Returns the raw underlying configuration value for this key.
14
19
pub fn raw_value ( & self ) -> & str {
15
20
& self . 0 . val
Original file line number Diff line number Diff line change @@ -1497,7 +1497,7 @@ target-dir = ''
1497
1497
1498
1498
assert_error (
1499
1499
config. target_dir ( ) . unwrap_err ( ) ,
1500
- "the target directory is set to an empty string in the config.toml file. " ,
1500
+ "the target directory is set to an empty string in [..]/.cargo/config " ,
1501
1501
) ;
1502
1502
}
1503
1503
You can’t perform that action at this time.
0 commit comments