mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 07:20:10 +01:00
compiler/rust: rewrite match into a simpler if let
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38807>
This commit is contained in:
parent
1def70585b
commit
cb57b77239
1 changed files with 5 additions and 8 deletions
|
|
@ -66,16 +66,13 @@ pub fn derive_as_slice(
|
||||||
Data::Struct(s) => {
|
Data::Struct(s) => {
|
||||||
let mut has_repr_c = false;
|
let mut has_repr_c = false;
|
||||||
for attr in attrs {
|
for attr in attrs {
|
||||||
match attr.meta {
|
if let Meta::List(ml) = attr.meta {
|
||||||
Meta::List(ml) => {
|
|
||||||
if ml.path.is_ident("repr")
|
if ml.path.is_ident("repr")
|
||||||
&& format!("{}", ml.tokens) == "C"
|
&& format!("{}", ml.tokens) == "C"
|
||||||
{
|
{
|
||||||
has_repr_c = true;
|
has_repr_c = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => (),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
assert!(has_repr_c, "Struct must be declared #[repr(C)]");
|
assert!(has_repr_c, "Struct must be declared #[repr(C)]");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue