Skip to content

Commit

Permalink
Remove needless late init
Browse files Browse the repository at this point in the history
  • Loading branch information
nvzqz committed Jan 28, 2024
1 parent fb68da6 commit 0b577bc
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/util/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,20 +121,17 @@ impl<T> PThreadKey<T> {
KEY_UNINIT => None,

key => unsafe {
#[allow(clippy::needless_late_init)]
let thread_local: *mut libc::c_void;

cfg_if::cfg_if! {
if #[cfg(all(
not(miri),
any(target_arch = "x86_64", target_arch = "aarch64"),
))] {
thread_local = fast::get_thread_local(key as usize);
let thread_local = fast::get_thread_local(key as usize);

#[cfg(test)]
assert_eq!(thread_local, libc::pthread_getspecific(key));
} else {
thread_local = libc::pthread_getspecific(key);
let thread_local = libc::pthread_getspecific(key);
}
}

Expand Down

0 comments on commit 0b577bc

Please sign in to comment.