]> git.lizzy.rs Git - rust.git/blob - tests/target/issue-2179.rs
Tidy up and pass tests
[rust.git] / tests / target / issue-2179.rs
1 // rustfmt-error_on_line_overflow: false
2
3 fn issue_2179() {
4     let (opts, rustflags, clear_env_rust_log) = {
5         // We mustn't lock configuration for the whole build process
6         let rls_config = rls_config.lock().unwrap();
7
8         let opts = CargoOptions::new(&rls_config);
9         trace!("Cargo compilation options:\n{:?}", opts);
10         let rustflags = prepare_cargo_rustflags(&rls_config);
11
12         // Warn about invalid specified bin target or package depending on current mode
13         // TODO: Return client notifications along with diagnostics to inform the user
14         if !rls_config.workspace_mode {
15             let cur_pkg_targets = ws.current().unwrap().targets();
16
17             if let &Some(ref build_bin) = rls_config.build_bin.as_ref() {
18                 let mut bins = cur_pkg_targets.iter().filter(|x| x.is_bin());
19                 if let None = bins.find(|x| x.name() == build_bin) {
20                     warn!(
21                         "cargo - couldn't find binary `{}` specified in `build_bin` configuration",
22                         build_bin
23                     );
24                 }
25             }
26         } else {
27             for package in &opts.package {
28                 if let None = ws.members().find(|x| x.name() == package) {
29                     warn!("cargo - couldn't find member package `{}` specified in `analyze_package` configuration", package);
30                 }
31             }
32         }
33
34         (opts, rustflags, rls_config.clear_env_rust_log)
35     };
36 }