diff options
author | Aleksey Kladov <[email protected]> | 2020-04-01 17:56:47 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-04-01 17:56:47 +0100 |
commit | 1ac345a9f693e54aecd2ad70731acc75f982d2ae (patch) | |
tree | a89ab4ea4332354c08e57d7ccece1743d2b9d1a3 | |
parent | 4936abdd49b1d0ba6b2a858bee3a5a665de9d6f3 (diff) |
Centralize defaults
-rw-r--r-- | crates/ra_flycheck/src/lib.rs | 10 | ||||
-rw-r--r-- | 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 f3d6f8f5f..b54a30ab8 100644 --- a/crates/ra_flycheck/src/lib.rs +++ b/crates/ra_flycheck/src/lib.rs | |||
@@ -28,16 +28,6 @@ pub enum FlycheckConfig { | |||
28 | CustomCommand { command: String, args: Vec<String> }, | 28 | CustomCommand { command: String, args: Vec<String> }, |
29 | } | 29 | } |
30 | 30 | ||
31 | impl Default for FlycheckConfig { | ||
32 | fn default() -> Self { | ||
33 | FlycheckConfig::CargoCommand { | ||
34 | command: "check".to_string(), | ||
35 | all_targets: true, | ||
36 | extra_args: Vec::new(), | ||
37 | } | ||
38 | } | ||
39 | } | ||
40 | |||
41 | /// Flycheck wraps the shared state and communication machinery used for | 31 | /// Flycheck wraps the shared state and communication machinery used for |
42 | /// running `cargo check` (or other compatible command) and providing | 32 | /// running `cargo check` (or other compatible command) and providing |
43 | /// diagnostics based on the output. | 33 | /// diagnostics based on the output. |
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index 57372768c..d95ed9ec7 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs | |||
@@ -51,12 +51,6 @@ pub enum RustfmtConfig { | |||
51 | }, | 51 | }, |
52 | } | 52 | } |
53 | 53 | ||
54 | impl Default for RustfmtConfig { | ||
55 | fn default() -> Self { | ||
56 | RustfmtConfig::Rustfmt { extra_args: Vec::new() } | ||
57 | } | ||
58 | } | ||
59 | |||
60 | #[derive(Debug, Clone, Default)] | 54 | #[derive(Debug, Clone, Default)] |
61 | pub struct ClientCapsConfig { | 55 | pub struct ClientCapsConfig { |
62 | pub location_link: bool, | 56 | pub location_link: bool, |
@@ -85,8 +79,12 @@ impl Default for Config { | |||
85 | add_call_argument_snippets: true, | 79 | add_call_argument_snippets: true, |
86 | }, | 80 | }, |
87 | call_info_full: true, | 81 | call_info_full: true, |
88 | rustfmt: RustfmtConfig::default(), | 82 | rustfmt: RustfmtConfig::Rustfmt { extra_args: Vec::new() }, |
89 | check: Some(FlycheckConfig::default()), | 83 | check: Some(FlycheckConfig::CargoCommand { |
84 | command: "check".to_string(), | ||
85 | all_targets: true, | ||
86 | extra_args: Vec::new(), | ||
87 | }), | ||
90 | vscode_lldb: false, | 88 | vscode_lldb: false, |
91 | proc_macro_srv: None, | 89 | proc_macro_srv: None, |
92 | lru_capacity: None, | 90 | lru_capacity: None, |