@@ -1194,8 +1194,8 @@ fn default_profile_candidates() -> Vec<clap_complete::CompletionCandidate> {
1194
1194
1195
1195
fn get_feature_candidates ( ) -> CargoResult < Vec < clap_complete:: CompletionCandidate > > {
1196
1196
let gctx = new_gctx_for_completions ( ) ?;
1197
- let manifest_path = find_root_manifest_for_wd ( gctx . cwd ( ) ) ? ;
1198
- let ws = Workspace :: new ( & manifest_path , & gctx) ?;
1197
+
1198
+ let ws = Workspace :: new ( & find_root_manifest_for_wd ( gctx . cwd ( ) ) ? , & gctx) ?;
1199
1199
let mut feature_candidates = Vec :: new ( ) ;
1200
1200
1201
1201
// Process all packages in the workspace
@@ -1271,9 +1271,9 @@ fn get_bin_candidates() -> Vec<clap_complete::CompletionCandidate> {
1271
1271
}
1272
1272
1273
1273
fn get_targets_from_metadata ( ) -> CargoResult < Vec < ( InternedString , Target ) > > {
1274
- let cwd = std :: env :: current_dir ( ) ?;
1275
- let gctx = GlobalContext :: new ( shell :: Shell :: new ( ) , cwd . clone ( ) , cargo_home_with_cwd ( & cwd ) ? ) ;
1276
- let ws = Workspace :: new ( & find_root_manifest_for_wd ( & cwd) ?, & gctx) ?;
1274
+ let gctx = new_gctx_for_completions ( ) ?;
1275
+
1276
+ let ws = Workspace :: new ( & find_root_manifest_for_wd ( gctx . cwd ( ) ) ?, & gctx) ?;
1277
1277
1278
1278
let targets = ws
1279
1279
. members ( )
@@ -1329,9 +1329,9 @@ fn get_target_triples_from_rustup() -> CargoResult<Vec<clap_complete::Completion
1329
1329
}
1330
1330
1331
1331
fn get_target_triples_from_rustc ( ) -> CargoResult < Vec < clap_complete:: CompletionCandidate > > {
1332
- let cwd = std :: env :: current_dir ( ) ?;
1333
- let gctx = GlobalContext :: new ( shell :: Shell :: new ( ) , cwd . clone ( ) , cargo_home_with_cwd ( & cwd ) ? ) ;
1334
- let ws = Workspace :: new ( & find_root_manifest_for_wd ( & PathBuf :: from ( & cwd) ) ?, & gctx) ;
1332
+ let gctx = new_gctx_for_completions ( ) ?;
1333
+
1334
+ let ws = Workspace :: new ( & find_root_manifest_for_wd ( gctx . cwd ( ) ) ?, & gctx) ;
1335
1335
1336
1336
let rustc = gctx. load_global_rustc ( ws. as_ref ( ) . ok ( ) ) ?;
1337
1337
0 commit comments