internal: prep to 2021 edition

This commit is contained in:
Aleksey Kladov 2021-08-20 16:20:18 +03:00
parent 2fbe1c9934
commit 1850849325
4 changed files with 11 additions and 9 deletions

View file

@ -12,7 +12,7 @@ env:
CARGO_NET_RETRY: 10 CARGO_NET_RETRY: 10
CI: 1 CI: 1
RUST_BACKTRACE: short RUST_BACKTRACE: short
RUSTFLAGS: "-D warnings -W unreachable-pub" RUSTFLAGS: "-D warnings -W unreachable-pub -W rust-2021-compatibility"
RUSTUP_MAX_RETRIES: 10 RUSTUP_MAX_RETRIES: 10
jobs: jobs:

View file

@ -547,10 +547,10 @@ impl InFile<SyntaxToken> {
self, self,
db: &dyn db::AstDatabase, db: &dyn db::AstDatabase,
) -> impl Iterator<Item = InFile<SyntaxNode>> + '_ { ) -> impl Iterator<Item = InFile<SyntaxNode>> + '_ {
self.value self.value.parent().into_iter().flat_map({
.parent() let file_id = self.file_id;
.into_iter() move |parent| InFile::new(file_id, parent).ancestors_with_macros(db)
.flat_map(move |parent| InFile::new(self.file_id, parent).ancestors_with_macros(db)) })
} }
} }

View file

@ -30,16 +30,18 @@ impl<'a> RequestDispatcher<'a> {
Some(it) => it, Some(it) => it,
None => return Ok(self), None => return Ok(self),
}; };
let world = panic::AssertUnwindSafe(&mut *self.global_state); let global_state = panic::AssertUnwindSafe(&mut *self.global_state);
let response = panic::catch_unwind(move || { let response = panic::catch_unwind(move || {
let _ = &global_state;
let panic::AssertUnwindSafe(global_state) = global_state;
let _pctx = stdx::panic_context::enter(format!( let _pctx = stdx::panic_context::enter(format!(
"\nversion: {}\nrequest: {} {:#?}", "\nversion: {}\nrequest: {} {:#?}",
env!("REV"), env!("REV"),
R::METHOD, R::METHOD,
params params
)); ));
let result = f(world.0, params); let result = f(global_state, params);
result_to_response::<R>(id, result) result_to_response::<R>(id, result)
}) })
.map_err(|_err| format!("sync task {:?} panicked", R::METHOD))?; .map_err(|_err| format!("sync task {:?} panicked", R::METHOD))?;

View file

@ -420,12 +420,12 @@ impl GlobalState {
self.prime_caches_queue.request_op(); self.prime_caches_queue.request_op();
if self.prime_caches_queue.should_start_op() { if self.prime_caches_queue.should_start_op() {
self.task_pool.handle.spawn_with_sender({ self.task_pool.handle.spawn_with_sender({
let snap = self.snapshot(); let analysis = self.snapshot().analysis;
move |sender| { move |sender| {
let cb = |progress| { let cb = |progress| {
sender.send(Task::PrimeCaches(progress)).unwrap(); sender.send(Task::PrimeCaches(progress)).unwrap();
}; };
match snap.analysis.prime_caches(cb) { match analysis.prime_caches(cb) {
Ok(()) => (), Ok(()) => (),
Err(_canceled) => (), Err(_canceled) => (),
} }