Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

egl: remove cfg from code not needing them #1707

Merged
merged 2 commits into from
Oct 3, 2024

Conversation

kchibisov
Copy link
Member

--

@MarijnS95 I think something like that?

@MarijnS95
Copy link
Member

I also wonder if we need optimizations like:

#[cfg(not(any(wayland_platform, x11_platform)))]
fn supports_transparency(&self) -> Option<bool> {
None
}
#[cfg(any(wayland_platform, x11_platform))]
fn supports_transparency(&self) -> Option<bool> {
use raw_window_handle::RawDisplayHandle;
match *self.inner.display.inner._native_display? {
#[cfg(x11_platform)]
RawDisplayHandle::Xlib(_) | RawDisplayHandle::Xcb(_) => {
self.x11_visual().map(|visual| visual.supports_transparency())
},
#[cfg(wayland_platform)]
RawDisplayHandle::Wayland(_) => Some(self.alpha_size() != 0),
_ => None,
}
}

This should compile down to match ...? { _ => None } which can only ever return None anyway.

@kchibisov
Copy link
Member Author

that's to avoid clippy lints and is easier to read.

@MarijnS95
Copy link
Member

Didn't we typically disable that lint because this "single match arm" occurs in many more places in glutin?

I don't find the (negated) cfgs particularly easy to read nor modify when new variants ever need to be added.

@kchibisov
Copy link
Member Author

kchibisov commented Oct 3, 2024

We don't disable it and it's never triggered., you can grep for it

@kchibisov
Copy link
Member Author

Seems like clippy doesn't complain about it, so I guess it's fine.

We can not do anything about the gl_generator at this point, so just
continue disabling things clippy don't really like.
@kchibisov kchibisov merged commit d8e7569 into rust-windowing:master Oct 3, 2024
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants