diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index c159d319..4d17ff07 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -185,6 +185,8 @@ jobs: run: cargo update --package async-io --precise 2.5.0 - name: Pin last polling release supporting our msrv of Rust 1.68 run: cargo update --package polling --precise 3.10.0 + - name: Pin last async-lock release supporting our msrv of Rust 1.68 + run: cargo update --package async-lock --precise 3.4.1 # build - name: cargo check x11rb-protocol with all features diff --git a/generator/src/generator/namespace/mod.rs b/generator/src/generator/namespace/mod.rs index 1a2f019a..6e9b716e 100644 --- a/generator/src/generator/namespace/mod.rs +++ b/generator/src/generator/namespace/mod.rs @@ -569,25 +569,28 @@ impl<'ns, 'c> NamespaceGenerator<'ns, 'c> { out, ); let field_size = field.size().unwrap(); - if bytes_name.is_some() && field_size == union_size { - outln!(out, "Self({})", bytes_name.unwrap()); - } else { - outln!(out, "let value = ["); - for result_byte in result_bytes.iter() { - outln!(out.indent(), "{},", result_byte); + match bytes_name { + Some(bytes_name) if field_size == union_size => { + outln!(out, "Self({})", bytes_name); } - // This is needed to handle cases such as Behavior.type or - // Action.type from the XKB extension. - // - // FIXME: For those cases it might be better to omit the - // serialize implementation. - if field_size != union_size { - for _ in 0..(union_size - field_size) { - outln!(out.indent(), "0,"); + _ => { + outln!(out, "let value = ["); + for result_byte in result_bytes.iter() { + outln!(out.indent(), "{},", result_byte); + } + // This is needed to handle cases such as Behavior.type or + // Action.type from the XKB extension. + // + // FIXME: For those cases it might be better to omit the + // serialize implementation. + if field_size != union_size { + for _ in 0..(union_size - field_size) { + outln!(out.indent(), "0,"); + } } + outln!(out, "];"); + outln!(out, "Self(value)"); } - outln!(out, "];"); - outln!(out, "Self(value)"); } }); outln!(out, "}}");