mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 13:50: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 {
|
Self {
|
||||||
has_images: has_images,
|
has_images: has_images,
|
||||||
has_timestamp: cap_timestamp && timer_resolution > 0,
|
has_timestamp: cap_timestamp && timer_resolution > 0,
|
||||||
image_2d_size: has_images.then_some(image_2d_size).unwrap_or_default(),
|
image_2d_size: if has_images { image_2d_size } else { 0 },
|
||||||
max_read_images: has_images.then_some(max_read_images).unwrap_or_default(),
|
max_read_images: if has_images { max_read_images } else { 0 },
|
||||||
max_write_images: has_images.then_some(max_write_images).unwrap_or_default(),
|
max_write_images: if has_images { max_write_images } else { 0 },
|
||||||
timer_resolution: timer_resolution,
|
timer_resolution: timer_resolution,
|
||||||
has_create_fence_fd: ctx.is_create_fence_fd_supported(),
|
has_create_fence_fd: ctx.is_create_fence_fd_supported(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|
|
||||||
|
|
@ -258,18 +258,16 @@ impl SPIRVBin {
|
||||||
.iter()
|
.iter()
|
||||||
.map(|a| SPIRVKernelArg {
|
.map(|a| SPIRVKernelArg {
|
||||||
// SAFETY: we have a valid C string pointer here
|
// SAFETY: we have a valid C string pointer here
|
||||||
name: a
|
name: if !a.name.is_null() {
|
||||||
.name
|
unsafe { CStr::from_ptr(a.name) }.to_owned()
|
||||||
.is_null()
|
} else {
|
||||||
.not()
|
Default::default()
|
||||||
.then(|| unsafe { CStr::from_ptr(a.name) }.to_owned())
|
},
|
||||||
.unwrap_or_default(),
|
type_name: if !a.type_name.is_null() {
|
||||||
type_name: a
|
unsafe { CStr::from_ptr(a.type_name) }.to_owned()
|
||||||
.type_name
|
} else {
|
||||||
.is_null()
|
Default::default()
|
||||||
.not()
|
},
|
||||||
.then(|| unsafe { CStr::from_ptr(a.type_name) }.to_owned())
|
|
||||||
.unwrap_or_default(),
|
|
||||||
access_qualifier: clc_kernel_arg_access_qualifier(a.access_qualifier),
|
access_qualifier: clc_kernel_arg_access_qualifier(a.access_qualifier),
|
||||||
address_qualifier: a.address_qualifier,
|
address_qualifier: a.address_qualifier,
|
||||||
type_qualifier: clc_kernel_arg_type_qualifier(a.type_qualifier),
|
type_qualifier: clc_kernel_arg_type_qualifier(a.type_qualifier),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue