Skip to content

Commit 61a3f6d

Browse files
committed
Simplify
1 parent 28077f9 commit 61a3f6d

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

crates/rust-analyzer/src/global_state.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use ra_vfs::{LineEndings, RootEntry, Vfs, VfsChange, VfsFile, VfsTask, Watch};
1818
use stdx::format_to;
1919

2020
use crate::{
21-
config::Config,
21+
config::{Config, FilesWatcher},
2222
diagnostics::{CheckFixes, DiagnosticCollection},
2323
main_loop::pending_requests::{CompletedRequest, LatestRequests},
2424
to_proto::url_from_abs_path,
@@ -76,7 +76,6 @@ impl GlobalState {
7676
workspaces: Vec<ProjectWorkspace>,
7777
lru_capacity: Option<usize>,
7878
exclude_globs: &[Glob],
79-
watch: Watch,
8079
config: Config,
8180
) -> GlobalState {
8281
let mut change = AnalysisChange::new();
@@ -111,6 +110,7 @@ impl GlobalState {
111110

112111
let (task_sender, task_receiver) = unbounded();
113112
let task_sender = Box::new(move |t| task_sender.send(t).unwrap());
113+
let watch = Watch(matches!(config.files.watcher, FilesWatcher::Notify));
114114
let (mut vfs, vfs_roots) = Vfs::new(roots, task_sender, watch);
115115

116116
let mut extern_source_roots = FxHashMap::default();

crates/rust-analyzer/src/main_loop.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use ra_flycheck::{CheckTask, Status};
2727
use ra_ide::{Canceled, FileId, LineIndex};
2828
use ra_prof::profile;
2929
use ra_project_model::{PackageRoot, ProjectWorkspace};
30-
use ra_vfs::{VfsTask, Watch};
30+
use ra_vfs::VfsTask;
3131
use rustc_hash::FxHashSet;
3232
use serde::{de::DeserializeOwned, Serialize};
3333
use threadpool::ThreadPool;
@@ -160,13 +160,7 @@ pub fn main_loop(config: Config, connection: Connection) -> Result<()> {
160160
connection.sender.send(request.into()).unwrap();
161161
}
162162

163-
GlobalState::new(
164-
workspaces,
165-
config.lru_capacity,
166-
&globs,
167-
Watch(matches!(config.files.watcher, FilesWatcher::Notify)),
168-
config,
169-
)
163+
GlobalState::new(workspaces, config.lru_capacity, &globs, config)
170164
};
171165

172166
loop_state.roots_total = global_state.vfs.read().n_roots();

0 commit comments

Comments
 (0)