Skip to content

Commit c0c6b81

Browse files
committed
Reduced nesting
1 parent 392d376 commit c0c6b81

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

library/std/src/sys/pal/unix/thread.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,12 @@ impl Thread {
132132
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "dragonfly"))]
133133
pub fn set_name(name: &CStr) {
134134
unsafe {
135-
let name = {
136-
cfg_if::cfg_if! {
137-
if #[cfg(target_os = "linux")] {
138-
const TASK_COMM_LEN: usize = 16;
139-
&truncate_cstr::<{ TASK_COMM_LEN }>(name)
140-
} else {
141-
name.to_bytes()
142-
}
135+
cfg_if::cfg_if! {
136+
if #[cfg(target_os = "linux")] {
137+
const TASK_COMM_LEN: usize = 16;
138+
let name = &truncate_cstr::<{ TASK_COMM_LEN }>(name);
139+
} else {
140+
let name = name.to_bytes();
143141
}
144142
};
145143
// Available since glibc 2.12, musl 1.1.16, and uClibc 1.0.20 for Linux,

0 commit comments

Comments
 (0)