@@ -34,7 +34,7 @@ pub struct Client {
3434 pub(crate) capabilities: OnceCell<lsp::ServerCapabilities>,
3535 offset_encoding: OffsetEncoding,
3636 config: Option<Value>,
37− root_path: Option<std::path::PathBuf>,
37+ root_path: std::path::PathBuf,
3838 root_uri: Option<lsp::Url>,
3939 workspace_folders: Vec<lsp::WorkspaceFolder>,
4040 req_timeout: u64,
@@ -74,9 +74,7 @@ impl Client {
7474
7575 let root_path = find_root(None, root_markers);
7676
77− let root_uri = root_path
78− .clone()
79− .and_then(|root| lsp::Url::from_file_path(root).ok());
77+ let root_uri = lsp::Url::from_file_path(root_path.clone()).ok();
8078
8179 // TODO: support multiple workspace folders
8280 let workspace_folders = root_uri
@@ -281,10 +279,7 @@ impl Client {
281279 workspace_folders: Some(self.workspace_folders.clone()),
282280 // root_path is obsolete, but some clients like pyright still use it so we specify both.
283281 // clients will prefer _uri if possible
284− root_path: self
285− .root_path
286− .clone()
287− .and_then(|path| path.to_str().map(|path| path.to_owned())),
282+ root_path: self.root_path.to_str().map(|path| path.to_owned()),
288283 root_uri: self.root_uri.clone(),
289284 initialization_options: self.config.clone(),
290285 capabilities: lsp::ClientCapabilities {