1 //! Config used by the language server.
3 //! We currently get this config from `initialize` LSP request, which is not the
4 //! best way to do it, but was the simplest thing we could implement.
6 //! Of particular interest is the `feature_flags` hash map: while other fields
7 //! configure the server itself, feature flags are passed into analysis, and
8 //! tweak things like automatic insertion of `()` in completions.
10 use std::{convert::TryFrom, ffi::OsString, path::PathBuf};
12 use flycheck::FlycheckConfig;
15 AssistConfig, CompletionConfig, DiagnosticsConfig, HoverConfig, InlayHintsConfig,
18 use ide_db::helpers::{insert_use::MergeBehavior, SnippetCap};
19 use itertools::Itertools;
20 use lsp_types::{ClientCapabilities, MarkupKind};
21 use project_model::{CargoConfig, ProjectJson, ProjectJsonData, ProjectManifest};
22 use rustc_hash::FxHashSet;
23 use serde::{de::DeserializeOwned, Deserialize};
26 use crate::{caps::completion_item_edit_resolve, diagnostics::DiagnosticsMapConfig};
30 /// The strategy to use when inserting new imports or merging imports.
31 assist_importMergeBehaviour: MergeBehaviorDef = "\"full\"",
32 /// The path structure for newly inserted paths to use.
33 assist_importPrefix: ImportPrefixDef = "\"plain\"",
35 /// Show function name and docs in parameter hints.
36 callInfo_full: bool = "true",
38 /// Automatically refresh project info via `cargo metadata` on
39 /// `Cargo.toml` changes.
40 cargo_autoreload: bool = "true",
41 /// Activate all available features.
42 cargo_allFeatures: bool = "false",
43 /// List of features to activate.
44 cargo_features: Vec<String> = "[]",
45 /// Run `cargo check` on startup to get the correct value for package
47 cargo_loadOutDirsFromCheck: bool = "false",
48 /// Do not activate the `default` feature.
49 cargo_noDefaultFeatures: bool = "false",
50 /// Compilation target (target triple).
51 cargo_target: Option<String> = "null",
52 /// Internal config for debugging, disables loading of sysroot crates.
53 cargo_noSysroot: bool = "false",
55 /// Run specified `cargo check` command for diagnostics on save.
56 checkOnSave_enable: bool = "true",
57 /// Check with all features (will be passed as `--all-features`).
58 /// Defaults to `#rust-analyzer.cargo.allFeatures#`.
59 checkOnSave_allFeatures: Option<bool> = "null",
60 /// Check all targets and tests (will be passed as `--all-targets`).
61 checkOnSave_allTargets: bool = "true",
62 /// Cargo command to use for `cargo check`.
63 checkOnSave_command: String = "\"check\"",
64 /// Do not activate the `default` feature.
65 checkOnSave_noDefaultFeatures: Option<bool> = "null",
66 /// Check for a specific target. Defaults to
67 /// `#rust-analyzer.cargo.target#`.
68 checkOnSave_target: Option<String> = "null",
69 /// Extra arguments for `cargo check`.
70 checkOnSave_extraArgs: Vec<String> = "[]",
71 /// List of features to activate. Defaults to
72 /// `#rust-analyzer.cargo.features#`.
73 checkOnSave_features: Option<Vec<String>> = "null",
74 /// Advanced option, fully override the command rust-analyzer uses for
75 /// checking. The command should include `--message-format=json` or
77 checkOnSave_overrideCommand: Option<Vec<String>> = "null",
79 /// Whether to add argument snippets when completing functions.
80 completion_addCallArgumentSnippets: bool = "true",
81 /// Whether to add parenthesis when completing functions.
82 completion_addCallParenthesis: bool = "true",
83 /// Whether to show postfix snippets like `dbg`, `if`, `not`, etc.
84 completion_postfix_enable: bool = "true",
85 /// Toggles the additional completions that automatically add imports when completed.
86 /// Note that your client must specify the `additionalTextEdits` LSP client capability to truly have this feature enabled.
87 completion_autoimport_enable: bool = "true",
89 /// Whether to show native rust-analyzer diagnostics.
90 diagnostics_enable: bool = "true",
91 /// Whether to show experimental rust-analyzer diagnostics that might
92 /// have more false positives than usual.
93 diagnostics_enableExperimental: bool = "true",
94 /// List of rust-analyzer diagnostics to disable.
95 diagnostics_disabled: FxHashSet<String> = "[]",
96 /// List of warnings that should be displayed with info severity.\n\nThe
97 /// warnings will be indicated by a blue squiggly underline in code and
98 /// a blue icon in the `Problems Panel`.
99 diagnostics_warningsAsHint: Vec<String> = "[]",
100 /// List of warnings that should be displayed with hint severity.\n\nThe
101 /// warnings will be indicated by faded text or three dots in code and
102 /// will not show up in the `Problems Panel`.
103 diagnostics_warningsAsInfo: Vec<String> = "[]",
105 /// Controls file watching implementation.
106 files_watcher: String = "\"client\"",
108 /// Whether to show `Debug` action. Only applies when
109 /// `#rust-analyzer.hoverActions.enable#` is set.
110 hoverActions_debug: bool = "true",
111 /// Whether to show HoverActions in Rust files.
112 hoverActions_enable: bool = "true",
113 /// Whether to show `Go to Type Definition` action. Only applies when
114 /// `#rust-analyzer.hoverActions.enable#` is set.
115 hoverActions_gotoTypeDef: bool = "true",
116 /// Whether to show `Implementations` action. Only applies when
117 /// `#rust-analyzer.hoverActions.enable#` is set.
118 hoverActions_implementations: bool = "true",
119 /// Whether to show `Run` action. Only applies when
120 /// `#rust-analyzer.hoverActions.enable#` is set.
121 hoverActions_run: bool = "true",
122 /// Use markdown syntax for links in hover.
123 hoverActions_linksInHover: bool = "true",
125 /// Whether to show inlay type hints for method chains.
126 inlayHints_chainingHints: bool = "true",
127 /// Maximum length for inlay hints. Default is unlimited.
128 inlayHints_maxLength: Option<usize> = "null",
129 /// Whether to show function parameter name inlay hints at the call
131 inlayHints_parameterHints: bool = "true",
132 /// Whether to show inlay type hints for variables.
133 inlayHints_typeHints: bool = "true",
135 /// Whether to show `Debug` lens. Only applies when
136 /// `#rust-analyzer.lens.enable#` is set.
137 lens_debug: bool = "true",
138 /// Whether to show CodeLens in Rust files.
139 lens_enable: bool = "true",
140 /// Whether to show `Implementations` lens. Only applies when
141 /// `#rust-analyzer.lens.enable#` is set.
142 lens_implementations: bool = "true",
143 /// Whether to show `Run` lens. Only applies when
144 /// `#rust-analyzer.lens.enable#` is set.
145 lens_run: bool = "true",
146 /// Whether to show `Method References` lens. Only applies when
147 /// `#rust-analyzer.lens.enable#` is set.
148 lens_methodReferences: bool = "false",
150 /// Disable project auto-discovery in favor of explicitly specified set
151 /// of projects.\n\nElements must be paths pointing to `Cargo.toml`,
152 /// `rust-project.json`, or JSON objects in `rust-project.json` format.
153 linkedProjects: Vec<ManifestOrProjectJson> = "[]",
155 /// Number of syntax trees rust-analyzer keeps in memory. Defaults to 128.
156 lruCapacity: Option<usize> = "null",
158 /// Whether to show `can't find Cargo.toml` error message.
159 notifications_cargoTomlNotFound: bool = "true",
161 /// Enable Proc macro support, `#rust-analyzer.cargo.loadOutDirsFromCheck#` must be
163 procMacro_enable: bool = "false",
164 /// Internal config, path to proc-macro server executable (typically,
165 /// this is rust-analyzer itself, but we override this in tests).
166 procMacro_server: Option<PathBuf> = "null",
168 /// Command to be executed instead of 'cargo' for runnables.
169 runnables_overrideCargo: Option<String> = "null",
170 /// Additional arguments to be passed to cargo for runnables such as
171 /// tests or binaries.\nFor example, it may be `--release`.
172 runnables_cargoExtraArgs: Vec<String> = "[]",
174 /// Path to the rust compiler sources, for usage in rustc_private projects.
175 rustcSource : Option<PathBuf> = "null",
177 /// Additional arguments to `rustfmt`.
178 rustfmt_extraArgs: Vec<String> = "[]",
179 /// Advanced option, fully override the command rust-analyzer uses for
181 rustfmt_overrideCommand: Option<Vec<String>> = "null",
185 impl Default for ConfigData {
186 fn default() -> Self {
187 ConfigData::from_json(serde_json::Value::Null)
191 #[derive(Debug, Clone)]
193 caps: lsp_types::ClientCapabilities,
195 pub discovered_projects: Option<Vec<ProjectManifest>>,
196 pub root_path: AbsPathBuf,
199 #[derive(Debug, Clone, Eq, PartialEq)]
200 pub enum LinkedProject {
201 ProjectManifest(ProjectManifest),
202 InlineJsonProject(ProjectJson),
205 impl From<ProjectManifest> for LinkedProject {
206 fn from(v: ProjectManifest) -> Self {
207 LinkedProject::ProjectManifest(v)
211 impl From<ProjectJson> for LinkedProject {
212 fn from(v: ProjectJson) -> Self {
213 LinkedProject::InlineJsonProject(v)
217 #[derive(Clone, Debug, PartialEq, Eq)]
218 pub struct LensConfig {
221 pub implementations: bool,
222 pub method_refs: bool,
226 pub fn any(&self) -> bool {
227 self.implementations || self.runnable() || self.references()
230 pub fn none(&self) -> bool {
234 pub fn runnable(&self) -> bool {
235 self.run || self.debug
238 pub fn references(&self) -> bool {
243 #[derive(Debug, Clone)]
244 pub struct FilesConfig {
245 pub watcher: FilesWatcher,
246 pub exclude: Vec<String>,
249 #[derive(Debug, Clone)]
250 pub enum FilesWatcher {
255 #[derive(Debug, Clone)]
256 pub struct NotificationsConfig {
257 pub cargo_toml_not_found: bool,
260 #[derive(Debug, Clone)]
261 pub enum RustfmtConfig {
262 Rustfmt { extra_args: Vec<String> },
263 CustomCommand { command: String, args: Vec<String> },
266 /// Configuration for runnable items, such as `main` function or tests.
267 #[derive(Debug, Clone)]
268 pub struct RunnablesConfig {
269 /// Custom command to be executed instead of `cargo` for runnables.
270 pub override_cargo: Option<String>,
271 /// Additional arguments for the `cargo`, e.g. `--release`.
272 pub cargo_extra_args: Vec<String>,
276 pub fn new(root_path: AbsPathBuf, caps: ClientCapabilities) -> Self {
277 Config { caps, data: ConfigData::default(), discovered_projects: None, root_path }
279 pub fn update(&mut self, json: serde_json::Value) {
280 log::info!("updating config from JSON: {:#}", json);
281 if json.is_null() || json.as_object().map_or(false, |it| it.is_empty()) {
284 self.data = ConfigData::from_json(json);
287 pub fn json_schema() -> serde_json::Value {
288 ConfigData::json_schema()
294 || -> _ { Some($expr) }()
297 macro_rules! try_or {
298 ($expr:expr, $or:expr) => {
299 try_!($expr).unwrap_or($or)
304 pub fn linked_projects(&self) -> Vec<LinkedProject> {
305 if self.data.linkedProjects.is_empty() {
306 self.discovered_projects
311 .map(LinkedProject::from)
317 .filter_map(|linked_project| {
318 let res = match linked_project {
319 ManifestOrProjectJson::Manifest(it) => {
320 let path = self.root_path.join(it);
321 ProjectManifest::from_manifest_file(path)
322 .map_err(|e| log::error!("failed to load linked project: {}", e))
326 ManifestOrProjectJson::ProjectJson(it) => {
327 ProjectJson::new(&self.root_path, it.clone()).into()
336 pub fn location_link(&self) -> bool {
337 try_or!(self.caps.text_document.as_ref()?.definition?.link_support?, false)
339 pub fn line_folding_only(&self) -> bool {
340 try_or!(self.caps.text_document.as_ref()?.folding_range.as_ref()?.line_folding_only?, false)
342 pub fn hierarchical_symbols(&self) -> bool {
349 .hierarchical_document_symbol_support?,
353 pub fn code_action_literals(&self) -> bool {
360 .code_action_literal_support
364 pub fn work_done_progress(&self) -> bool {
365 try_or!(self.caps.window.as_ref()?.work_done_progress?, false)
367 pub fn code_action_resolve(&self) -> bool {
381 .any(|it| it == "edit")
383 pub fn signature_help_label_offsets(&self) -> bool {
390 .signature_information
392 .parameter_information
394 .label_offset_support?,
399 fn experimental(&self, index: &'static str) -> bool {
400 try_or!(self.caps.experimental.as_ref()?.get(index)?.as_bool()?, false)
402 pub fn code_action_group(&self) -> bool {
403 self.experimental("codeActionGroup")
405 pub fn hover_actions(&self) -> bool {
406 self.experimental("hoverActions")
408 pub fn status_notification(&self) -> bool {
409 self.experimental("statusNotification")
412 pub fn publish_diagnostics(&self) -> bool {
413 self.data.diagnostics_enable
415 pub fn diagnostics(&self) -> DiagnosticsConfig {
417 disable_experimental: !self.data.diagnostics_enableExperimental,
418 disabled: self.data.diagnostics_disabled.clone(),
421 pub fn diagnostics_map(&self) -> DiagnosticsMapConfig {
422 DiagnosticsMapConfig {
423 warnings_as_info: self.data.diagnostics_warningsAsInfo.clone(),
424 warnings_as_hint: self.data.diagnostics_warningsAsHint.clone(),
427 pub fn lru_capacity(&self) -> Option<usize> {
428 self.data.lruCapacity
430 pub fn proc_macro_srv(&self) -> Option<(PathBuf, Vec<OsString>)> {
431 if !self.data.procMacro_enable {
435 let path = self.data.procMacro_server.clone().or_else(|| std::env::current_exe().ok())?;
436 Some((path, vec!["proc-macro".into()]))
438 pub fn files(&self) -> FilesConfig {
440 watcher: match self.data.files_watcher.as_str() {
441 "notify" => FilesWatcher::Notify,
442 "client" | _ => FilesWatcher::Client,
447 pub fn notifications(&self) -> NotificationsConfig {
448 NotificationsConfig { cargo_toml_not_found: self.data.notifications_cargoTomlNotFound }
450 pub fn cargo_autoreload(&self) -> bool {
451 self.data.cargo_autoreload
453 pub fn cargo(&self) -> CargoConfig {
454 let rustc_source = self.data.rustcSource.clone().and_then(|it| {
455 AbsPathBuf::try_from(it)
456 .map_err(|_| log::error!("rustc source directory must be an absolute path"))
461 no_default_features: self.data.cargo_noDefaultFeatures,
462 all_features: self.data.cargo_allFeatures,
463 features: self.data.cargo_features.clone(),
464 load_out_dirs_from_check: self.data.cargo_loadOutDirsFromCheck,
465 target: self.data.cargo_target.clone(),
467 no_sysroot: self.data.cargo_noSysroot,
470 pub fn rustfmt(&self) -> RustfmtConfig {
471 match &self.data.rustfmt_overrideCommand {
472 Some(args) if !args.is_empty() => {
473 let mut args = args.clone();
474 let command = args.remove(0);
475 RustfmtConfig::CustomCommand { command, args }
478 RustfmtConfig::Rustfmt { extra_args: self.data.rustfmt_extraArgs.clone() }
482 pub fn flycheck(&self) -> Option<FlycheckConfig> {
483 if !self.data.checkOnSave_enable {
486 let flycheck_config = match &self.data.checkOnSave_overrideCommand {
487 Some(args) if !args.is_empty() => {
488 let mut args = args.clone();
489 let command = args.remove(0);
490 FlycheckConfig::CustomCommand { command, args }
492 Some(_) | None => FlycheckConfig::CargoCommand {
493 command: self.data.checkOnSave_command.clone(),
498 .or(self.data.cargo_target.clone()),
499 all_targets: self.data.checkOnSave_allTargets,
500 no_default_features: self
502 .checkOnSave_noDefaultFeatures
503 .unwrap_or(self.data.cargo_noDefaultFeatures),
506 .checkOnSave_allFeatures
507 .unwrap_or(self.data.cargo_allFeatures),
510 .checkOnSave_features
512 .unwrap_or(self.data.cargo_features.clone()),
513 extra_args: self.data.checkOnSave_extraArgs.clone(),
516 Some(flycheck_config)
518 pub fn runnables(&self) -> RunnablesConfig {
520 override_cargo: self.data.runnables_overrideCargo.clone(),
521 cargo_extra_args: self.data.runnables_cargoExtraArgs.clone(),
524 pub fn inlay_hints(&self) -> InlayHintsConfig {
526 type_hints: self.data.inlayHints_typeHints,
527 parameter_hints: self.data.inlayHints_parameterHints,
528 chaining_hints: self.data.inlayHints_chainingHints,
529 max_length: self.data.inlayHints_maxLength,
532 fn merge_behavior(&self) -> Option<MergeBehavior> {
533 match self.data.assist_importMergeBehaviour {
534 MergeBehaviorDef::None => None,
535 MergeBehaviorDef::Full => Some(MergeBehavior::Full),
536 MergeBehaviorDef::Last => Some(MergeBehavior::Last),
539 pub fn completion(&self) -> CompletionConfig {
541 enable_postfix_completions: self.data.completion_postfix_enable,
542 enable_autoimport_completions: self.data.completion_autoimport_enable
543 && completion_item_edit_resolve(&self.caps),
544 add_call_parenthesis: self.data.completion_addCallParenthesis,
545 add_call_argument_snippets: self.data.completion_addCallArgumentSnippets,
546 merge: self.merge_behavior(),
547 snippet_cap: SnippetCap::new(try_or!(
560 pub fn assist(&self) -> AssistConfig {
562 snippet_cap: SnippetCap::new(self.experimental("snippetTextEdit")),
564 insert_use: InsertUseConfig {
565 merge: self.merge_behavior(),
566 prefix_kind: match self.data.assist_importPrefix {
567 ImportPrefixDef::Plain => PrefixKind::Plain,
568 ImportPrefixDef::ByCrate => PrefixKind::ByCrate,
569 ImportPrefixDef::BySelf => PrefixKind::BySelf,
574 pub fn call_info_full(&self) -> bool {
575 self.data.callInfo_full
577 pub fn lens(&self) -> LensConfig {
579 run: self.data.lens_enable && self.data.lens_run,
580 debug: self.data.lens_enable && self.data.lens_debug,
581 implementations: self.data.lens_enable && self.data.lens_implementations,
582 method_refs: self.data.lens_enable && self.data.lens_methodReferences,
585 pub fn hover(&self) -> HoverConfig {
587 implementations: self.data.hoverActions_enable
588 && self.data.hoverActions_implementations,
589 run: self.data.hoverActions_enable && self.data.hoverActions_run,
590 debug: self.data.hoverActions_enable && self.data.hoverActions_debug,
591 goto_type_def: self.data.hoverActions_enable && self.data.hoverActions_gotoTypeDef,
592 links_in_hover: self.data.hoverActions_linksInHover,
604 .contains(&MarkupKind::Markdown),
607 pub fn semantic_tokens_refresh(&self) -> bool {
608 try_or!(self.caps.workspace.as_ref()?.semantic_tokens.as_ref()?.refresh_support?, false)
610 pub fn code_lens_refresh(&self) -> bool {
611 try_or!(self.caps.workspace.as_ref()?.code_lens.as_ref()?.refresh_support?, false)
615 #[derive(Deserialize, Debug, Clone)]
617 enum ManifestOrProjectJson {
619 ProjectJson(ProjectJsonData),
622 #[derive(Deserialize, Debug, Clone)]
623 #[serde(rename_all = "snake_case")]
624 enum MergeBehaviorDef {
630 #[derive(Deserialize, Debug, Clone)]
631 #[serde(rename_all = "snake_case")]
632 enum ImportPrefixDef {
638 macro_rules! _config_data {
639 (struct $name:ident {
641 $(#[doc=$doc:literal])*
642 $field:ident: $ty:ty = $default:expr,
645 #[allow(non_snake_case)]
646 #[derive(Debug, Clone)]
647 struct $name { $($field: $ty,)* }
649 fn from_json(mut json: serde_json::Value) -> $name {
651 $field: get_field(&mut json, stringify!($field), $default),
655 fn json_schema() -> serde_json::Value {
658 let field = stringify!($field);
659 let ty = stringify!($ty);
660 (field, ty, &[$($doc),*], $default)
666 fn manual() -> String {
669 let field = stringify!($field);
670 let ty = stringify!($ty);
671 (field, ty, &[$($doc),*], $default)
678 use _config_data as config_data;
680 fn get_field<T: DeserializeOwned>(
681 json: &mut serde_json::Value,
685 let default = serde_json::from_str(default).unwrap();
687 let mut pointer = field.replace('_', "/");
688 pointer.insert(0, '/');
689 json.pointer_mut(&pointer)
690 .and_then(|it| serde_json::from_value(it.take()).ok())
694 fn schema(fields: &[(&'static str, &'static str, &[&str], &str)]) -> serde_json::Value {
695 for ((f1, ..), (f2, ..)) in fields.iter().zip(&fields[1..]) {
696 fn key(f: &str) -> &str {
697 f.splitn(2, "_").next().unwrap()
699 assert!(key(f1) <= key(f2), "wrong field order: {:?} {:?}", f1, f2);
704 .map(|(field, ty, doc, default)| {
705 let name = field.replace("_", ".");
706 let name = format!("rust-analyzer.{}", name);
707 let props = field_props(field, ty, doc, default);
710 .collect::<serde_json::Map<_, _>>();
714 fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json::Value {
715 let doc = doc.iter().map(|it| it.trim()).join(" ");
717 doc.ends_with('.') && doc.starts_with(char::is_uppercase),
718 "bad docs for {}: {:?}",
722 let default = default.parse::<serde_json::Value>().unwrap();
724 let mut map = serde_json::Map::default();
726 ($($key:literal: $value:tt),*$(,)?) => {{$(
727 map.insert($key.into(), serde_json::json!($value));
730 set!("markdownDescription": doc);
731 set!("default": default);
734 "bool" => set!("type": "boolean"),
735 "String" => set!("type": "string"),
736 "Vec<String>" => set! {
738 "items": { "type": "string" },
740 "FxHashSet<String>" => set! {
742 "items": { "type": "string" },
745 "Option<usize>" => set! {
746 "type": ["null", "integer"],
749 "Option<String>" => set! {
750 "type": ["null", "string"],
752 "Option<PathBuf>" => set! {
753 "type": ["null", "string"],
755 "Option<bool>" => set! {
756 "type": ["null", "boolean"],
758 "Option<Vec<String>>" => set! {
759 "type": ["null", "array"],
760 "items": { "type": "string" },
762 "MergeBehaviorDef" => set! {
764 "enum": ["none", "full", "last"],
765 "enumDescriptions": [
767 "Merge all layers of the import trees",
768 "Only merge the last layer of the import trees"
771 "ImportPrefixDef" => set! {
778 "enumDescriptions": [
779 "Insert import paths relative to the current module, using up to one `super` prefix if the parent module contains the requested item.",
780 "Prefix all import paths with `self` if they don't begin with `self`, `super`, `crate` or a crate name.",
781 "Force import paths to be absolute by always starting them with `crate` or the crate name they refer to."
784 "Vec<ManifestOrProjectJson>" => set! {
786 "items": { "type": ["string", "object"] },
788 _ => panic!("{}: {}", ty, default),
795 fn manual(fields: &[(&'static str, &'static str, &[&str], &str)]) -> String {
798 .map(|(field, _ty, doc, default)| {
799 let name = format!("rust-analyzer.{}", field.replace("_", "."));
800 format!("[[{}]]{} (default: `{}`)::\n{}\n", name, name, default, doc.join(" "))
809 use test_utils::project_dir;
814 fn schema_in_sync_with_package_json() {
815 let s = Config::json_schema();
816 let schema = format!("{:#}", s);
817 let schema = schema.trim_start_matches('{').trim_end_matches('}');
819 let package_json = project_dir().join("editors/code/package.json");
820 let package_json = fs::read_to_string(&package_json).unwrap();
822 let p = remove_ws(&package_json);
823 let s = remove_ws(&schema);
825 assert!(p.contains(&s), "update config in package.json. New config:\n{:#}", schema);
829 fn schema_in_sync_with_docs() {
830 let docs_path = project_dir().join("docs/user/generated_config.adoc");
831 let current = fs::read_to_string(&docs_path).unwrap();
832 let expected = ConfigData::manual();
834 if remove_ws(¤t) != remove_ws(&expected) {
835 fs::write(&docs_path, expected).unwrap();
836 panic!("updated config manual");
840 fn remove_ws(text: &str) -> String {
841 text.replace(char::is_whitespace, "")