@@ -5,6 +5,7 @@ use std::path::{Path, PathBuf};
5
5
use std:: rc:: Rc ;
6
6
use std:: slice;
7
7
8
+ use anyhow:: bail;
8
9
use glob:: glob;
9
10
use log:: debug;
10
11
use url:: Url ;
@@ -152,7 +153,7 @@ impl<'cfg> Workspace<'cfg> {
152
153
ws. target_dir = config. target_dir ( ) ?;
153
154
154
155
if manifest_path. is_relative ( ) {
155
- anyhow :: bail!(
156
+ bail ! (
156
157
"manifest_path:{:?} is not an absolute path. Please provide an absolute path." ,
157
158
manifest_path
158
159
)
@@ -523,7 +524,7 @@ impl<'cfg> Workspace<'cfg> {
523
524
return Ok ( Some ( root_config. clone ( ) ) ) ;
524
525
}
525
526
526
- _ => anyhow :: bail!(
527
+ _ => bail ! (
527
528
"root of a workspace inferred but wasn't a root: {}" ,
528
529
root_path. display( )
529
530
) ,
@@ -663,7 +664,7 @@ impl<'cfg> Workspace<'cfg> {
663
664
if exclude {
664
665
continue ;
665
666
}
666
- anyhow :: bail!(
667
+ bail ! (
667
668
"package `{}` is listed in workspace’s default-members \
668
669
but is not a member.",
669
670
path. display( )
@@ -785,7 +786,7 @@ impl<'cfg> Workspace<'cfg> {
785
786
MaybePackage :: Virtual ( _) => continue ,
786
787
} ;
787
788
if let Some ( prev) = names. insert ( name, member) {
788
- anyhow :: bail!(
789
+ bail ! (
789
790
"two packages named `{}` in this workspace:\n \
790
791
- {}\n \
791
792
- {}",
@@ -810,7 +811,7 @@ impl<'cfg> Workspace<'cfg> {
810
811
. collect ( ) ;
811
812
match roots. len ( ) {
812
813
1 => Ok ( ( ) ) ,
813
- 0 => anyhow :: bail!(
814
+ 0 => bail ! (
814
815
"`package.workspace` configuration points to a crate \
815
816
which is not configured with [workspace]: \n \
816
817
configuration at: {}\n \
@@ -819,7 +820,7 @@ impl<'cfg> Workspace<'cfg> {
819
820
self . root_manifest. as_ref( ) . unwrap( ) . display( )
820
821
) ,
821
822
_ => {
822
- anyhow :: bail!(
823
+ bail ! (
823
824
"multiple workspace roots found in the same workspace:\n {}" ,
824
825
roots
825
826
. iter( )
@@ -840,7 +841,7 @@ impl<'cfg> Workspace<'cfg> {
840
841
841
842
match root {
842
843
Some ( root) => {
843
- anyhow :: bail!(
844
+ bail ! (
844
845
"package `{}` is a member of the wrong workspace\n \
845
846
expected: {}\n \
846
847
actual: {}",
@@ -850,7 +851,7 @@ impl<'cfg> Workspace<'cfg> {
850
851
) ;
851
852
}
852
853
None => {
853
- anyhow :: bail!(
854
+ bail ! (
854
855
"workspace member `{}` is not hierarchically below \
855
856
the workspace root `{}`",
856
857
member. display( ) ,
@@ -907,7 +908,7 @@ impl<'cfg> Workspace<'cfg> {
907
908
}
908
909
}
909
910
} ;
910
- anyhow :: bail!(
911
+ bail ! (
911
912
"current package believes it's in a workspace when it's not:\n \
912
913
current: {}\n \
913
914
workspace: {}\n \n {}\n \
@@ -963,7 +964,7 @@ impl<'cfg> Workspace<'cfg> {
963
964
pub fn load ( & self , manifest_path : & Path ) -> CargoResult < Package > {
964
965
match self . packages . maybe_get ( manifest_path) {
965
966
Some ( & MaybePackage :: Package ( ref p) ) => return Ok ( p. clone ( ) ) ,
966
- Some ( & MaybePackage :: Virtual ( _) ) => anyhow :: bail!( "cannot load workspace root" ) ,
967
+ Some ( & MaybePackage :: Virtual ( _) ) => bail ! ( "cannot load workspace root" ) ,
967
968
None => { }
968
969
}
969
970
@@ -1143,7 +1144,7 @@ impl<'cfg> Workspace<'cfg> {
1143
1144
&& !requested_features. all_features
1144
1145
&& requested_features. uses_default_features )
1145
1146
{
1146
- anyhow :: bail!( "cannot specify features for packages outside of workspace" ) ;
1147
+ bail ! ( "cannot specify features for packages outside of workspace" ) ;
1147
1148
}
1148
1149
// Add all members from the workspace so we can ensure `-p nonmember`
1149
1150
// is in the resolve graph.
@@ -1159,7 +1160,7 @@ impl<'cfg> Workspace<'cfg> {
1159
1160
. copied ( )
1160
1161
. collect ( ) ;
1161
1162
// TODO: typo suggestions would be good here.
1162
- anyhow :: bail!(
1163
+ bail ! (
1163
1164
"none of the selected packages contains these features: {}" ,
1164
1165
missing. join( ", " )
1165
1166
) ;
0 commit comments