mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 03:00:11 +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) => {
|
||||
let mut has_repr_c = false;
|
||||
for attr in attrs {
|
||||
match attr.meta {
|
||||
Meta::List(ml) => {
|
||||
if let Meta::List(ml) = attr.meta {
|
||||
if ml.path.is_ident("repr")
|
||||
&& format!("{}", ml.tokens) == "C"
|
||||
{
|
||||
has_repr_c = true;
|
||||
}
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
assert!(has_repr_c, "Struct must be declared #[repr(C)]");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue