1 // rustfmt-version: Two
2 // rustfmt-error_on_line_overflow: false
5 let (opts, rustflags, clear_env_rust_log) = {
6 // We mustn't lock configuration for the whole build process
7 let rls_config = rls_config.lock().unwrap();
9 let opts = CargoOptions::new(&rls_config);
10 trace!("Cargo compilation options:\n{:?}", opts);
11 let rustflags = prepare_cargo_rustflags(&rls_config);
13 // Warn about invalid specified bin target or package depending on current mode
14 // TODO: Return client notifications along with diagnostics to inform the user
15 if !rls_config.workspace_mode {
16 let cur_pkg_targets = ws.current().unwrap().targets();
18 if let &Some(ref build_bin) = rls_config.build_bin.as_ref() {
19 let mut bins = cur_pkg_targets.iter().filter(|x| x.is_bin());
20 if let None = bins.find(|x| x.name() == build_bin) {
22 "cargo - couldn't find binary `{}` specified in `build_bin` configuration",
28 for package in &opts.package {
29 if let None = ws.members().find(|x| x.name() == package) {
31 "cargo - couldn't find member package `{}` specified in `analyze_package` configuration",
38 (opts, rustflags, rls_config.clear_env_rust_log)