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
CI: 1
RUST_BACKTRACE: short
RUSTFLAGS: "-D warnings -W unreachable-pub"
RUSTFLAGS: "-D warnings -W unreachable-pub -W rust-2021-compatibility"
RUSTUP_MAX_RETRIES: 10
jobs:

View file

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

View file

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

View file

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