|
3 | 3 | //! Of particular interest is the `feature_flags` hash map: while other fields |
4 | 4 | //! configure the server itself, feature flags are passed into analysis, and |
5 | 5 | //! tweak things like automatic insertion of `()` in completions. |
6 | | -use std::{ |
7 | | - env, fmt, iter, |
8 | | - ops::Not, |
9 | | - sync::{LazyLock, OnceLock}, |
10 | | -}; |
| 6 | +use std::{env, fmt, iter, ops::Not, sync::OnceLock}; |
11 | 7 |
|
12 | 8 | use cfg::{CfgAtom, CfgDiff}; |
13 | 9 | use hir::Symbol; |
@@ -805,16 +801,13 @@ impl std::ops::Deref for Config { |
805 | 801 |
|
806 | 802 | impl Config { |
807 | 803 | /// Path to the user configuration dir. This can be seen as a generic way to define what would be `$XDG_CONFIG_HOME/rust-analyzer` in Linux. |
808 | | - pub fn user_config_dir_path() -> Option<&'static AbsPath> { |
809 | | - static USER_CONFIG_PATH: LazyLock<Option<AbsPathBuf>> = LazyLock::new(|| { |
810 | | - let user_config_path = if let Some(path) = env::var_os("__TEST_RA_USER_CONFIG_DIR") { |
811 | | - std::path::PathBuf::from(path) |
812 | | - } else { |
813 | | - dirs::config_dir()?.join("rust-analyzer") |
814 | | - }; |
815 | | - Some(AbsPathBuf::assert_utf8(user_config_path)) |
816 | | - }); |
817 | | - USER_CONFIG_PATH.as_deref() |
| 804 | + pub fn user_config_dir_path() -> Option<AbsPathBuf> { |
| 805 | + let user_config_path = if let Some(path) = env::var_os("__TEST_RA_USER_CONFIG_DIR") { |
| 806 | + std::path::PathBuf::from(path) |
| 807 | + } else { |
| 808 | + dirs::config_dir()?.join("rust-analyzer") |
| 809 | + }; |
| 810 | + Some(AbsPathBuf::assert_utf8(user_config_path)) |
818 | 811 | } |
819 | 812 |
|
820 | 813 | pub fn same_source_root_parent_map( |
@@ -1254,7 +1247,7 @@ pub struct NotificationsConfig { |
1254 | 1247 | pub cargo_toml_not_found: bool, |
1255 | 1248 | } |
1256 | 1249 |
|
1257 | | -#[derive(Deserialize, Serialize, Debug, Clone)] |
| 1250 | +#[derive(Debug, Clone)] |
1258 | 1251 | pub enum RustfmtConfig { |
1259 | 1252 | Rustfmt { extra_args: Vec<String>, enable_range_formatting: bool }, |
1260 | 1253 | CustomCommand { command: String, args: Vec<String> }, |
|
0 commit comments