]> git.lizzy.rs Git - rust.git/blob - src/tools/rustfmt/tests/target/issue-2179/two.rs
Add 'src/tools/rustfmt/' from commit '7872306edf2e11a69aaffb9434088fd66b46a863'
[rust.git] / src / tools / rustfmt / tests / target / issue-2179 / two.rs
1 // rustfmt-version: Two
2 // rustfmt-error_on_line_overflow: false
3
4 fn issue_2179() {
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();
8
9         let opts = CargoOptions::new(&rls_config);
10         trace!("Cargo compilation options:\n{:?}", opts);
11         let rustflags = prepare_cargo_rustflags(&rls_config);
12
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();
17
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) {
21                     warn!(
22                         "cargo - couldn't find binary `{}` specified in `build_bin` configuration",
23                         build_bin
24                     );
25                 }
26             }
27         } else {
28             for package in &opts.package {
29                 if let None = ws.members().find(|x| x.name() == package) {
30                     warn!(
31                         "cargo - couldn't find member package `{}` specified in `analyze_package` configuration",
32                         package
33                     );
34                 }
35             }
36         }
37
38         (opts, rustflags, rls_config.clear_env_rust_log)
39     };
40 }