mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 03:00:11 +01:00
rusticl: rewrite blocks using if/else for clarity
Applying clippy's code suggestions. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38807>
This commit is contained in:
parent
5dbfa7f85d
commit
f70d1bcdbf
2 changed files with 13 additions and 15 deletions
|
|
@ -106,9 +106,9 @@ impl DeviceCaps {
|
|||
Self {
|
||||
has_images: has_images,
|
||||
has_timestamp: cap_timestamp && timer_resolution > 0,
|
||||
image_2d_size: has_images.then_some(image_2d_size).unwrap_or_default(),
|
||||
max_read_images: has_images.then_some(max_read_images).unwrap_or_default(),
|
||||
max_write_images: has_images.then_some(max_write_images).unwrap_or_default(),
|
||||
image_2d_size: if has_images { image_2d_size } else { 0 },
|
||||
max_read_images: if has_images { max_read_images } else { 0 },
|
||||
max_write_images: if has_images { max_write_images } else { 0 },
|
||||
timer_resolution: timer_resolution,
|
||||
has_create_fence_fd: ctx.is_create_fence_fd_supported(),
|
||||
..Default::default()
|
||||
|
|
|
|||
|
|
@ -258,18 +258,16 @@ impl SPIRVBin {
|
|||
.iter()
|
||||
.map(|a| SPIRVKernelArg {
|
||||
// SAFETY: we have a valid C string pointer here
|
||||
name: a
|
||||
.name
|
||||
.is_null()
|
||||
.not()
|
||||
.then(|| unsafe { CStr::from_ptr(a.name) }.to_owned())
|
||||
.unwrap_or_default(),
|
||||
type_name: a
|
||||
.type_name
|
||||
.is_null()
|
||||
.not()
|
||||
.then(|| unsafe { CStr::from_ptr(a.type_name) }.to_owned())
|
||||
.unwrap_or_default(),
|
||||
name: if !a.name.is_null() {
|
||||
unsafe { CStr::from_ptr(a.name) }.to_owned()
|
||||
} else {
|
||||
Default::default()
|
||||
},
|
||||
type_name: if !a.type_name.is_null() {
|
||||
unsafe { CStr::from_ptr(a.type_name) }.to_owned()
|
||||
} else {
|
||||
Default::default()
|
||||
},
|
||||
access_qualifier: clc_kernel_arg_access_qualifier(a.access_qualifier),
|
||||
address_qualifier: a.address_qualifier,
|
||||
type_qualifier: clc_kernel_arg_type_qualifier(a.type_qualifier),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue