rt(gl): use Option::filter instead of let_chains

This commit is contained in:
chyyran 2024-09-13 18:10:55 -04:00 committed by Ronny Chan
parent 0ba4c482b3
commit ab9ab6fe68
3 changed files with 11 additions and 11 deletions

View file

@ -69,8 +69,9 @@ where
location: VariableLocation,
_: &(),
) -> Option<()> {
if let Some(location) = location.location(block)
&& location.bindable()
if let Some(location) = location
.location(block)
.filter(|location| location.bindable())
{
if location.is_valid(BindingStage::VERTEX) {
unsafe {
@ -96,8 +97,9 @@ impl BindUniform<VariableLocation, &[f32; 4], ()> for GlUniformBinder {
location: VariableLocation,
_: &(),
) -> Option<()> {
if let Some(location) = location.location(block)
&& location.bindable()
if let Some(location) = location
.location(block)
.filter(|location| location.bindable())
{
unsafe {
if location.is_valid(BindingStage::VERTEX) {
@ -121,8 +123,9 @@ impl BindUniform<VariableLocation, &[f32; 16], ()> for GlUniformBinder {
location: VariableLocation,
_: &(),
) -> Option<()> {
if let Some(location) = location.location(block)
&& location.bindable()
if let Some(location) = location
.location(block)
.filter(|location| location.bindable())
{
unsafe {
if location.is_valid(BindingStage::VERTEX) {

View file

@ -28,12 +28,10 @@ impl FilterChainGL {
options: Option<&FilterChainOptionsGL>,
) -> Result<Self> {
let result = catch_unwind(|| {
if let Some(options) = options
&& options.use_dsa
{
if options.is_some_and(|options| options.use_dsa) {
return Ok(Self {
filter: FilterChainDispatch::DirectStateAccess(unsafe {
FilterChainImpl::load_from_preset(preset, Some(options))?
FilterChainImpl::load_from_preset(preset, options)?
}),
});
}

View file

@ -3,7 +3,6 @@
//! This crate should not be used directly.
//! See [`librashader::runtime::gl`](https://docs.rs/librashader/latest/librashader/runtime/gl/index.html) instead.
#![deny(unsafe_op_in_unsafe_fn)]
#![feature(let_chains)]
#![feature(type_alias_impl_trait)]
mod binding;