diff options
| author | Chayim Refael Friedman <chayimfr@gmail.com> | 2025-04-20 22:45:25 +0300 |
|---|---|---|
| committer | Chayim Refael Friedman <chayimfr@gmail.com> | 2025-04-20 22:45:25 +0300 |
| commit | 7db3d21a8a67fab94e3c5ece32b6a338077ce052 (patch) | |
| tree | 348f10f460d17edb76813541e6a7b64d3336bae9 /src/tools | |
| parent | d1108a7305841deb443ed3711b1f2b36e95e13b1 (diff) | |
When changing the config, do not emit an error if a field is missing
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs index 41fa7b4fbb8..1f44889883f 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs +++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs @@ -921,10 +921,10 @@ impl Config { tracing::info!("updating config from JSON: {:#}", json); if !(json.is_null() || json.as_object().is_some_and(|it| it.is_empty())) { - let mut json_errors = vec![]; let detached_files = get_field_json::<Vec<Utf8PathBuf>>( &mut json, - &mut json_errors, + // Do not record errors here; it is not an error if a field is missing here. + &mut Vec::new(), "detachedFiles", None, ) @@ -935,15 +935,16 @@ impl Config { patch_old_style::patch_json_for_outdated_configs(&mut json); - let mut json_errors = vec![]; let snips = get_field_json::<FxIndexMap<String, SnippetDef>>( &mut json, - &mut json_errors, + // Do not record errors here; it is not an error if a field is missing here. + &mut Vec::new(), "completion_snippets_custom", None, ) .unwrap_or(self.completion_snippets_custom().to_owned()); + let mut json_errors = vec![]; // IMPORTANT : This holds as long as ` completion_snippets_custom` is declared `client`. config.snippets.clear(); |
