From 20c088b9903a619a32b19e0e2bc9b289610a3783 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Esp=C3=ADn?= Date: Thu, 29 Jun 2023 17:17:10 +0200 Subject: [PATCH] fix: Remove conflicting rustfmt config for cli (#1135) --- packages/cli/rustfmt.toml | 8 -------- packages/cli/src/config.rs | 24 +++++++++++++----------- 2 files changed, 13 insertions(+), 19 deletions(-) delete mode 100644 packages/cli/rustfmt.toml diff --git a/packages/cli/rustfmt.toml b/packages/cli/rustfmt.toml deleted file mode 100644 index 39b98f125..000000000 --- a/packages/cli/rustfmt.toml +++ /dev/null @@ -1,8 +0,0 @@ -version = "Two" -edition = "2021" - -imports_granularity = "Crate" -#use_small_heuristics = "Max" -#control_brace_style = "ClosingNextLine" -normalize_comments = true -format_code_in_doc_comments = true diff --git a/packages/cli/src/config.rs b/packages/cli/src/config.rs index 9c87e266e..438fa252e 100644 --- a/packages/cli/src/config.rs +++ b/packages/cli/src/config.rs @@ -188,17 +188,19 @@ impl CrateConfig { let output_filename = { match &manifest.package.as_ref().unwrap().default_run { - Some(default_run_target) => { - default_run_target.to_owned() - }, - None => { - manifest.bin.iter().find(|b| b.name == manifest.package.as_ref().map(|pkg| pkg.name.clone())) - .or(manifest.bin.iter().find(|b| b.path == Some("src/main.rs".to_owned()))) - .or(manifest.bin.first()) - .or(manifest.lib.as_ref()) - .and_then(|prod| prod.name.clone()) - .expect("No executable or library found from cargo metadata.") - } + Some(default_run_target) => default_run_target.to_owned(), + None => manifest + .bin + .iter() + .find(|b| b.name == manifest.package.as_ref().map(|pkg| pkg.name.clone())) + .or(manifest + .bin + .iter() + .find(|b| b.path == Some("src/main.rs".to_owned()))) + .or(manifest.bin.first()) + .or(manifest.lib.as_ref()) + .and_then(|prod| prod.name.clone()) + .expect("No executable or library found from cargo metadata."), } }; let executable = ExecutableType::Binary(output_filename);