diff options
Diffstat (limited to 'crates/ra_lsp_server/src/server_world.rs')
-rw-r--r-- | crates/ra_lsp_server/src/server_world.rs | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/crates/ra_lsp_server/src/server_world.rs b/crates/ra_lsp_server/src/server_world.rs index c2167c5d8..02f2a37a8 100644 --- a/crates/ra_lsp_server/src/server_world.rs +++ b/crates/ra_lsp_server/src/server_world.rs | |||
@@ -80,10 +80,7 @@ impl ServerWorldState { | |||
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
83 | let libstd = ws | 83 | let libstd = ws.sysroot.std().and_then(|it| sysroot_crates.get(&it).map(|&it| it)); |
84 | .sysroot | ||
85 | .std() | ||
86 | .and_then(|it| sysroot_crates.get(&it).map(|&it| it)); | ||
87 | 84 | ||
88 | let mut pkg_to_lib_crate = FxHashMap::default(); | 85 | let mut pkg_to_lib_crate = FxHashMap::default(); |
89 | let mut pkg_crates = FxHashMap::default(); | 86 | let mut pkg_crates = FxHashMap::default(); |
@@ -99,10 +96,7 @@ impl ServerWorldState { | |||
99 | lib_tgt = Some(crate_id); | 96 | lib_tgt = Some(crate_id); |
100 | pkg_to_lib_crate.insert(pkg, crate_id); | 97 | pkg_to_lib_crate.insert(pkg, crate_id); |
101 | } | 98 | } |
102 | pkg_crates | 99 | pkg_crates.entry(pkg).or_insert_with(Vec::new).push(crate_id); |
103 | .entry(pkg) | ||
104 | .or_insert_with(Vec::new) | ||
105 | .push(crate_id); | ||
106 | } | 100 | } |
107 | } | 101 | } |
108 | 102 | ||
@@ -192,18 +186,8 @@ impl ServerWorldState { | |||
192 | libs.push((SourceRootId(root.0.into()), files)); | 186 | libs.push((SourceRootId(root.0.into()), files)); |
193 | } | 187 | } |
194 | } | 188 | } |
195 | VfsChange::AddFile { | 189 | VfsChange::AddFile { root, file, path, text } => { |
196 | root, | 190 | change.add_file(SourceRootId(root.0.into()), FileId(file.0.into()), path, text); |
197 | file, | ||
198 | path, | ||
199 | text, | ||
200 | } => { | ||
201 | change.add_file( | ||
202 | SourceRootId(root.0.into()), | ||
203 | FileId(file.0.into()), | ||
204 | path, | ||
205 | text, | ||
206 | ); | ||
207 | } | 191 | } |
208 | VfsChange::RemoveFile { root, file, path } => { | 192 | VfsChange::RemoveFile { root, file, path } => { |
209 | change.remove_file(SourceRootId(root.0.into()), FileId(file.0.into()), path) | 193 | change.remove_file(SourceRootId(root.0.into()), FileId(file.0.into()), path) |
@@ -247,9 +231,7 @@ impl ServerWorld { | |||
247 | } | 231 | } |
248 | 232 | ||
249 | pub fn uri_to_file_id(&self, uri: &Url) -> Result<FileId> { | 233 | pub fn uri_to_file_id(&self, uri: &Url) -> Result<FileId> { |
250 | let path = uri | 234 | let path = uri.to_file_path().map_err(|()| format_err!("invalid uri: {}", uri))?; |
251 | .to_file_path() | ||
252 | .map_err(|()| format_err!("invalid uri: {}", uri))?; | ||
253 | let file = self | 235 | let file = self |
254 | .vfs | 236 | .vfs |
255 | .read() | 237 | .read() |