From 1ac345a9f693e54aecd2ad70731acc75f982d2ae Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 1 Apr 2020 18:56:47 +0200 Subject: [PATCH] Centralize defaults --- crates/ra_flycheck/src/lib.rs | 10 ---------- crates/rust-analyzer/src/config.rs | 14 ++++++-------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/crates/ra_flycheck/src/lib.rs b/crates/ra_flycheck/src/lib.rs index f3d6f8f5f96..b54a30ab85f 100644 --- a/crates/ra_flycheck/src/lib.rs +++ b/crates/ra_flycheck/src/lib.rs @@ -28,16 +28,6 @@ pub enum FlycheckConfig { CustomCommand { command: String, args: Vec }, } -impl Default for FlycheckConfig { - fn default() -> Self { - FlycheckConfig::CargoCommand { - command: "check".to_string(), - all_targets: true, - extra_args: Vec::new(), - } - } -} - /// Flycheck wraps the shared state and communication machinery used for /// running `cargo check` (or other compatible command) and providing /// diagnostics based on the output. diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index 57372768c43..d95ed9ec7c6 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs @@ -51,12 +51,6 @@ pub enum RustfmtConfig { }, } -impl Default for RustfmtConfig { - fn default() -> Self { - RustfmtConfig::Rustfmt { extra_args: Vec::new() } - } -} - #[derive(Debug, Clone, Default)] pub struct ClientCapsConfig { pub location_link: bool, @@ -85,8 +79,12 @@ fn default() -> Self { add_call_argument_snippets: true, }, call_info_full: true, - rustfmt: RustfmtConfig::default(), - check: Some(FlycheckConfig::default()), + rustfmt: RustfmtConfig::Rustfmt { extra_args: Vec::new() }, + check: Some(FlycheckConfig::CargoCommand { + command: "check".to_string(), + all_targets: true, + extra_args: Vec::new(), + }), vscode_lldb: false, proc_macro_srv: None, lru_capacity: None,