From 89ce6b6664c9451c3c6ab9446fcd40697c5b0267 Mon Sep 17 00:00:00 2001 From: Xavier Denis Date: Thu, 12 Nov 2020 18:46:47 +0100 Subject: Address review comments --- crates/project_model/src/lib.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'crates') diff --git a/crates/project_model/src/lib.rs b/crates/project_model/src/lib.rs index 8e1cee0d6..4531b1928 100644 --- a/crates/project_model/src/lib.rs +++ b/crates/project_model/src/lib.rs @@ -46,7 +46,7 @@ impl fmt::Debug for ProjectWorkspace { .field("n_sysroot_crates", &sysroot.crates().len()) .field( "n_rustc_compiler_crates", - &rustc.as_ref().map(|rc| rc.packages().len()).unwrap_or(0), + &rustc.as_ref().map_or(0, |rc| rc.packages().len()), ) .finish(), ProjectWorkspace::Json { project, sysroot } => { @@ -314,8 +314,7 @@ impl ProjectWorkspace { match self { ProjectWorkspace::Json { project, .. } => project.n_crates(), ProjectWorkspace::Cargo { cargo, sysroot, rustc } => { - let rustc_package_len = rustc.as_ref().map(|rc| rc.packages().len()).unwrap_or(0); - dbg!(rustc_package_len); + let rustc_package_len = rustc.as_ref().map_or(0, |rc| rc.packages().len()); cargo.packages().len() + sysroot.crates().len() + rustc_package_len } } -- cgit v1.2.3