aboutsummaryrefslogtreecommitdiff
path: root/crates/project_model
diff options
context:
space:
mode:
Diffstat (limited to 'crates/project_model')
-rw-r--r--crates/project_model/src/build_data.rs2
-rw-r--r--crates/project_model/src/cargo_workspace.rs2
-rw-r--r--crates/project_model/src/sysroot.rs4
-rw-r--r--crates/project_model/src/workspace.rs12
4 files changed, 10 insertions, 10 deletions
diff --git a/crates/project_model/src/build_data.rs b/crates/project_model/src/build_data.rs
index 33a4f8168..53cb4bae7 100644
--- a/crates/project_model/src/build_data.rs
+++ b/crates/project_model/src/build_data.rs
@@ -184,7 +184,7 @@ impl WorkspaceBuildData {
184 184
185 // Copy-pasted from existing cargo_metadata. It seems like we 185 // Copy-pasted from existing cargo_metadata. It seems like we
186 // should be using sered_stacker here? 186 // should be using sered_stacker here?
187 let mut deserializer = serde_json::Deserializer::from_str(&line); 187 let mut deserializer = serde_json::Deserializer::from_str(line);
188 deserializer.disable_recursion_limit(); 188 deserializer.disable_recursion_limit();
189 let message = Message::deserialize(&mut deserializer) 189 let message = Message::deserialize(&mut deserializer)
190 .unwrap_or(Message::TextLine(line.to_string())); 190 .unwrap_or(Message::TextLine(line.to_string()));
diff --git a/crates/project_model/src/cargo_workspace.rs b/crates/project_model/src/cargo_workspace.rs
index b8ad08364..ac079f83e 100644
--- a/crates/project_model/src/cargo_workspace.rs
+++ b/crates/project_model/src/cargo_workspace.rs
@@ -278,7 +278,7 @@ impl CargoWorkspace {
278 id, edition, name, manifest_path, version, metadata, .. 278 id, edition, name, manifest_path, version, metadata, ..
279 } = meta_pkg; 279 } = meta_pkg;
280 let meta = from_value::<PackageMetadata>(metadata.clone()).unwrap_or_default(); 280 let meta = from_value::<PackageMetadata>(metadata.clone()).unwrap_or_default();
281 let is_member = ws_members.contains(&id); 281 let is_member = ws_members.contains(id);
282 let edition = edition 282 let edition = edition
283 .parse::<Edition>() 283 .parse::<Edition>()
284 .with_context(|| format!("Failed to parse edition {}", edition))?; 284 .with_context(|| format!("Failed to parse edition {}", edition))?;
diff --git a/crates/project_model/src/sysroot.rs b/crates/project_model/src/sysroot.rs
index 4e39d6dd3..a22f79c15 100644
--- a/crates/project_model/src/sysroot.rs
+++ b/crates/project_model/src/sysroot.rs
@@ -142,12 +142,12 @@ fn discover_sysroot_src_dir(
142 log::debug!("RUST_SRC_PATH is set, but is invalid (no core: {:?}), ignoring", core); 142 log::debug!("RUST_SRC_PATH is set, but is invalid (no core: {:?}), ignoring", core);
143 } 143 }
144 144
145 get_rust_src(&sysroot_path) 145 get_rust_src(sysroot_path)
146 .or_else(|| { 146 .or_else(|| {
147 let mut rustup = Command::new(toolchain::rustup()); 147 let mut rustup = Command::new(toolchain::rustup());
148 rustup.current_dir(current_dir).args(&["component", "add", "rust-src"]); 148 rustup.current_dir(current_dir).args(&["component", "add", "rust-src"]);
149 utf8_stdout(rustup).ok()?; 149 utf8_stdout(rustup).ok()?;
150 get_rust_src(&sysroot_path) 150 get_rust_src(sysroot_path)
151 }) 151 })
152 .ok_or_else(|| { 152 .ok_or_else(|| {
153 format_err!( 153 format_err!(
diff --git a/crates/project_model/src/workspace.rs b/crates/project_model/src/workspace.rs
index 84990075f..ef0f3c9e4 100644
--- a/crates/project_model/src/workspace.rs
+++ b/crates/project_model/src/workspace.rs
@@ -185,7 +185,7 @@ impl ProjectWorkspace {
185 185
186 pub fn load_detached_files(detached_files: Vec<AbsPathBuf>) -> Result<ProjectWorkspace> { 186 pub fn load_detached_files(detached_files: Vec<AbsPathBuf>) -> Result<ProjectWorkspace> {
187 let sysroot = Sysroot::discover( 187 let sysroot = Sysroot::discover(
188 &detached_files.first().ok_or_else(|| format_err!("No detached files to load"))?, 188 detached_files.first().ok_or_else(|| format_err!("No detached files to load"))?,
189 )?; 189 )?;
190 let rustc_cfg = rustc_cfg::get(None, None); 190 let rustc_cfg = rustc_cfg::get(None, None);
191 Ok(ProjectWorkspace::DetachedFiles { files: detached_files, sysroot, rustc_cfg }) 191 Ok(ProjectWorkspace::DetachedFiles { files: detached_files, sysroot, rustc_cfg })
@@ -324,7 +324,7 @@ impl ProjectWorkspace {
324 pub fn collect_build_data_configs(&self, collector: &mut BuildDataCollector) { 324 pub fn collect_build_data_configs(&self, collector: &mut BuildDataCollector) {
325 match self { 325 match self {
326 ProjectWorkspace::Cargo { cargo, .. } => { 326 ProjectWorkspace::Cargo { cargo, .. } => {
327 collector.add_config(&cargo.workspace_root(), cargo.build_data_config().clone()); 327 collector.add_config(cargo.workspace_root(), cargo.build_data_config().clone());
328 } 328 }
329 _ => {} 329 _ => {}
330 } 330 }
@@ -348,7 +348,7 @@ fn project_json_to_crate_graph(
348 .crates() 348 .crates()
349 .filter_map(|(crate_id, krate)| { 349 .filter_map(|(crate_id, krate)| {
350 let file_path = &krate.root_module; 350 let file_path = &krate.root_module;
351 let file_id = load(&file_path)?; 351 let file_id = load(file_path)?;
352 Some((crate_id, krate, file_id)) 352 Some((crate_id, krate, file_id))
353 }) 353 })
354 .map(|(crate_id, krate, file_id)| { 354 .map(|(crate_id, krate, file_id)| {
@@ -534,7 +534,7 @@ fn detached_files_to_crate_graph(
534 cfg_options.extend(rustc_cfg); 534 cfg_options.extend(rustc_cfg);
535 535
536 for detached_file in detached_files { 536 for detached_file in detached_files {
537 let file_id = match load(&detached_file) { 537 let file_id = match load(detached_file) {
538 Some(file_id) => file_id, 538 Some(file_id) => file_id,
539 None => { 539 None => {
540 log::error!("Failed to load detached file {:?}", detached_file); 540 log::error!("Failed to load detached file {:?}", detached_file);
@@ -602,7 +602,7 @@ fn handle_rustc_crates(
602 crate_graph, 602 crate_graph,
603 &rustc_workspace[pkg], 603 &rustc_workspace[pkg],
604 rustc_build_data_map.and_then(|it| it.get(&rustc_workspace[pkg].id)), 604 rustc_build_data_map.and_then(|it| it.get(&rustc_workspace[pkg].id)),
605 &cfg_options, 605 cfg_options,
606 proc_macro_loader, 606 proc_macro_loader,
607 file_id, 607 file_id,
608 &rustc_workspace[tgt].name, 608 &rustc_workspace[tgt].name,
@@ -685,7 +685,7 @@ fn add_target_crate_root(
685 let proc_macro = build_data 685 let proc_macro = build_data
686 .as_ref() 686 .as_ref()
687 .and_then(|it| it.proc_macro_dylib_path.as_ref()) 687 .and_then(|it| it.proc_macro_dylib_path.as_ref())
688 .map(|it| proc_macro_loader(&it)) 688 .map(|it| proc_macro_loader(it))
689 .unwrap_or_default(); 689 .unwrap_or_default();
690 690
691 let display_name = CrateDisplayName::from_canonical_name(cargo_name.to_string()); 691 let display_name = CrateDisplayName::from_canonical_name(cargo_name.to_string());