Merge commit 'ddf105b646' into sync-from-ra

This commit is contained in:
Laurențiu Nicola 2024-02-11 08:40:19 +02:00
parent 0816d49d83
commit e41ab350d6
378 changed files with 14720 additions and 3111 deletions

View file

@ -29,4 +29,4 @@ winapi = { version = "0.3.9", features = ["winerror"] }
# default = [ "backtrace" ]
[lints]
workspace = true
workspace = true

View file

@ -54,12 +54,13 @@ use core::any::{Any, TypeId};
use core::hash::BuildHasherDefault;
use core::marker::PhantomData;
use ::std::collections::hash_map::{self, HashMap};
use ::std::collections::hash_map;
/// Raw access to the underlying `HashMap`.
///
/// This alias is provided for convenience because of the ugly third generic parameter.
pub type RawMap<A> = HashMap<TypeId, Box<A>, BuildHasherDefault<TypeIdHasher>>;
#[allow(clippy::disallowed_types)] // Uses a custom hasher
pub type RawMap<A> = hash_map::HashMap<TypeId, Box<A>, BuildHasherDefault<TypeIdHasher>>;
/// A collection containing zero or one values for any given type and allowing convenient,
/// type-safe access to those values.

View file

@ -23,12 +23,14 @@ pub fn is_ci() -> bool {
}
#[must_use]
#[allow(clippy::print_stderr)]
pub fn timeit(label: &'static str) -> impl Drop {
let start = Instant::now();
defer(move || eprintln!("{}: {:.2?}", label, start.elapsed()))
}
/// Prints backtrace to stderr, useful for debugging.
#[allow(clippy::print_stderr)]
pub fn print_backtrace() {
#[cfg(feature = "backtrace")]
eprintln!("{:?}", backtrace::Backtrace::new());

View file

@ -18,6 +18,7 @@ pub struct PanicContext {
}
impl PanicContext {
#[allow(clippy::print_stderr)]
fn init() {
let default_hook = panic::take_hook();
let hook = move |panic_info: &panic::PanicInfo<'_>| {
@ -43,7 +44,7 @@ impl Drop for PanicContext {
fn with_ctx(f: impl FnOnce(&mut Vec<String>)) {
thread_local! {
static CTX: RefCell<Vec<String>> = RefCell::new(Vec::new());
static CTX: RefCell<Vec<String>> = const { RefCell::new(Vec::new()) };
}
CTX.with(|ctx| f(&mut ctx.borrow_mut()));
}

View file

@ -14,8 +14,7 @@ pub fn shuffle<T>(slice: &mut [T], mut rand_index: impl FnMut(usize) -> usize) {
}
pub fn seed() -> u64 {
use std::collections::hash_map::RandomState;
use std::hash::{BuildHasher, Hasher};
RandomState::new().build_hasher().finish()
#[allow(clippy::disallowed_types)]
std::collections::hash_map::RandomState::new().build_hasher().finish()
}