@@ -1194,8 +1194,8 @@ fn default_profile_candidates() -> Vec<clap_complete::CompletionCandidate> {
11941194
11951195fn get_feature_candidates ( ) -> CargoResult < Vec < clap_complete:: CompletionCandidate > > {
11961196 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) ?;
11991199 let mut feature_candidates = Vec :: new ( ) ;
12001200
12011201 // Process all packages in the workspace
@@ -1271,9 +1271,9 @@ fn get_bin_candidates() -> Vec<clap_complete::CompletionCandidate> {
12711271}
12721272
12731273fn 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) ?;
12771277
12781278 let targets = ws
12791279 . members ( )
@@ -1329,9 +1329,9 @@ fn get_target_triples_from_rustup() -> CargoResult<Vec<clap_complete::Completion
13291329}
13301330
13311331fn 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) ;
13351335
13361336 let rustc = gctx. load_global_rustc ( ws. as_ref ( ) . ok ( ) ) ?;
13371337
0 commit comments