Use #[non_exhaustive] where appropriate

Due to the std/alloc split, it is not possible to make
`alloc::collections::TryReserveError::AllocError` non-exhaustive without
having an unstable, doc-hidden method to construct (which negates the
benefits from `#[non_exhaustive]`.
This commit is contained in:
Jacob Pratt
2021-06-24 04:16:11 -04:00
parent 6a758ea7e4
commit 3f14f4b3ce
8 changed files with 29 additions and 39 deletions

View File

@@ -70,13 +70,12 @@ mod dl {
use std::sync::{Mutex, MutexGuard};
pub fn lock() -> MutexGuard<'static, Guard> {
static LOCK: SyncLazy<Mutex<Guard>> = SyncLazy::new(|| Mutex::new(Guard { _priv: () }));
static LOCK: SyncLazy<Mutex<Guard>> = SyncLazy::new(|| Mutex::new(Guard));
LOCK.lock().unwrap()
}
pub struct Guard {
_priv: (),
}
#[non_exhaustive]
pub struct Guard;
impl Guard {
pub fn get(&mut self) -> Result<(), String> {