Переглянути джерело

Increase max line width and run rustfmt

I think this makes stuff look cleaner - the previous line width is a bit
too little on reasonable editors
Isaac Woods 5 роки тому
батько
коміт
b5306d0400

+ 1 - 9
acpi/src/fadt.rs

@@ -1,12 +1,4 @@
-use crate::{
-    sdt::SdtHeader,
-    Acpi,
-    AcpiError,
-    AcpiHandler,
-    AmlTable,
-    GenericAddress,
-    PhysicalMapping,
-};
+use crate::{sdt::SdtHeader, Acpi, AcpiError, AcpiHandler, AmlTable, GenericAddress, PhysicalMapping};
 
 type ExtendedField<T> = crate::sdt::ExtendedField<T, typenum::U2>;
 

+ 1 - 5
acpi/src/handler.rs

@@ -27,11 +27,7 @@ pub trait AcpiHandler {
     /// page-aligned, so the implementation may have to add padding to either end. The given
     /// size must be greater or equal to the size of a `T`. The virtual address the memory is
     /// mapped to does not matter, as long as it is accessible from `acpi`.
-    fn map_physical_region<T>(
-        &mut self,
-        physical_address: usize,
-        size: usize,
-    ) -> PhysicalMapping<T>;
+    fn map_physical_region<T>(&mut self, physical_address: usize, size: usize) -> PhysicalMapping<T>;
 
     /// Unmap the given physical mapping. Safe because we consume the mapping, and so it can't be
     /// used after being passed to this function.

+ 1 - 4
acpi/src/hpet.rs

@@ -33,10 +33,7 @@ pub(crate) struct HpetTable {
     page_protection_oem: u8,
 }
 
-pub(crate) fn parse_hpet(
-    acpi: &mut Acpi,
-    mapping: &PhysicalMapping<HpetTable>,
-) -> Result<(), AcpiError> {
+pub(crate) fn parse_hpet(acpi: &mut Acpi, mapping: &PhysicalMapping<HpetTable>) -> Result<(), AcpiError> {
     (*mapping).header.validate(b"HPET")?;
     let hpet = &*mapping;
 

+ 7 - 19
acpi/src/lib.rs

@@ -164,10 +164,7 @@ where
     parse_validated_rsdp(handler, rsdp_mapping)
 }
 
-fn parse_validated_rsdp<H>(
-    handler: &mut H,
-    rsdp_mapping: PhysicalMapping<Rsdp>,
-) -> Result<Acpi, AcpiError>
+fn parse_validated_rsdp<H>(handler: &mut H, rsdp_mapping: PhysicalMapping<Rsdp>) -> Result<Acpi, AcpiError>
 where
     H: AcpiHandler,
 {
@@ -197,11 +194,7 @@ where
 ///
 /// If the given revision is 0, an address to the RSDT is expected. Otherwise, an address to
 /// the XSDT is expected.
-pub fn parse_rsdt<H>(
-    handler: &mut H,
-    revision: u8,
-    physical_address: usize,
-) -> Result<Acpi, AcpiError>
+pub fn parse_rsdt<H>(handler: &mut H, revision: u8, physical_address: usize) -> Result<Acpi, AcpiError>
 where
     H: AcpiHandler,
 {
@@ -217,8 +210,7 @@ where
     };
 
     let header = sdt::peek_at_sdt_header(handler, physical_address);
-    let mapping =
-        handler.map_physical_region::<SdtHeader>(physical_address, header.length() as usize);
+    let mapping = handler.map_physical_region::<SdtHeader>(physical_address, header.length() as usize);
 
     if revision == 0 {
         /*
@@ -226,14 +218,12 @@ where
          */
         (*mapping).validate(b"RSDT")?;
 
-        let num_tables =
-            ((*mapping).length() as usize - mem::size_of::<SdtHeader>()) / mem::size_of::<u32>();
+        let num_tables = ((*mapping).length() as usize - mem::size_of::<SdtHeader>()) / mem::size_of::<u32>();
         let tables_base =
             ((mapping.virtual_start.as_ptr() as usize) + mem::size_of::<SdtHeader>()) as *const u32;
 
         for i in 0..num_tables {
-            sdt::dispatch_sdt(&mut acpi, handler, unsafe { *tables_base.offset(i as isize) }
-                as usize)?;
+            sdt::dispatch_sdt(&mut acpi, handler, unsafe { *tables_base.offset(i as isize) } as usize)?;
         }
     } else {
         /*
@@ -241,14 +231,12 @@ where
          */
         (*mapping).validate(b"XSDT")?;
 
-        let num_tables =
-            ((*mapping).length() as usize - mem::size_of::<SdtHeader>()) / mem::size_of::<u64>();
+        let num_tables = ((*mapping).length() as usize - mem::size_of::<SdtHeader>()) / mem::size_of::<u64>();
         let tables_base =
             ((mapping.virtual_start.as_ptr() as usize) + mem::size_of::<SdtHeader>()) as *const u64;
 
         for i in 0..num_tables {
-            sdt::dispatch_sdt(&mut acpi, handler, unsafe { *tables_base.offset(i as isize) }
-                as usize)?;
+            sdt::dispatch_sdt(&mut acpi, handler, unsafe { *tables_base.offset(i as isize) } as usize)?;
         }
     }
 

+ 4 - 18
acpi/src/madt.rs

@@ -1,12 +1,5 @@
 use crate::{
-    interrupt::{
-        InterruptModel,
-        InterruptSourceOverride,
-        IoApic,
-        NmiSource,
-        Polarity,
-        TriggerMode,
-    },
+    interrupt::{InterruptModel, InterruptSourceOverride, IoApic, NmiSource, Polarity, TriggerMode},
     sdt::SdtHeader,
     Acpi,
     AcpiError,
@@ -47,9 +40,7 @@ pub(crate) struct Madt {
 impl Madt {
     fn entries(&self) -> MadtEntryIter {
         MadtEntryIter {
-            pointer: unsafe {
-                (self as *const Madt as *const u8).offset(mem::size_of::<Madt>() as isize)
-            },
+            pointer: unsafe { (self as *const Madt as *const u8).offset(mem::size_of::<Madt>() as isize) },
             remaining_length: self.header.length() - mem::size_of::<Madt>() as u32,
             _phantom: PhantomData,
         }
@@ -399,10 +390,7 @@ where
 
 /// This parses the MADT and gathers information about a APIC interrupt model. We error if we
 /// encounter an entry that doesn't configure the APIC.
-fn parse_apic_model(
-    acpi: &mut Acpi,
-    mapping: &PhysicalMapping<Madt>,
-) -> Result<InterruptModel, AcpiError> {
+fn parse_apic_model(acpi: &mut Acpi, mapping: &PhysicalMapping<Madt>) -> Result<InterruptModel, AcpiError> {
     use crate::interrupt::LocalInterruptLine;
 
     let mut local_apic_address = (*mapping).local_apic_address as u64;
@@ -451,9 +439,7 @@ fn parse_apic_model(
 
             MadtEntry::InterruptSourceOverride(ref entry) => {
                 if entry.bus != 0 {
-                    return Err(AcpiError::InvalidMadt(
-                        MadtError::InterruptOverrideEntryHasInvalidBus,
-                    ));
+                    return Err(AcpiError::InvalidMadt(MadtError::InterruptOverrideEntryHasInvalidBus));
                 }
 
                 let (polarity, trigger_mode) = parse_mps_inti_flags(entry.flags)?;

+ 2 - 11
acpi/src/mcfg.rs

@@ -15,13 +15,7 @@ pub struct PciConfigRegions {
 impl PciConfigRegions {
     /// Get the physical address of the start of the configuration space for a given PCI-E device
     /// function. Returns `None` if there isn't an entry in the MCFG that manages that device.
-    pub fn physical_address(
-        &self,
-        segment_group_no: u16,
-        bus: u8,
-        device: u8,
-        function: u8,
-    ) -> Option<u64> {
+    pub fn physical_address(&self, segment_group_no: u16, bus: u8, device: u8, function: u8) -> Option<u64> {
         // First, find the memory region that handles this segment and bus. This method is fine
         // because there should only be one region that handles each segment group + bus
         // combination.
@@ -70,10 +64,7 @@ struct McfgEntry {
     _reserved: u32,
 }
 
-pub(crate) fn parse_mcfg(
-    acpi: &mut Acpi,
-    mapping: &PhysicalMapping<Mcfg>,
-) -> Result<(), AcpiError> {
+pub(crate) fn parse_mcfg(acpi: &mut Acpi, mapping: &PhysicalMapping<Mcfg>) -> Result<(), AcpiError> {
     (*mapping).header.validate(b"MCFG")?;
 
     acpi.pci_config_regions =

+ 6 - 21
acpi/src/sdt.rs

@@ -1,13 +1,4 @@
-use crate::{
-    fadt::Fadt,
-    hpet::HpetTable,
-    madt::Madt,
-    mcfg::Mcfg,
-    Acpi,
-    AcpiError,
-    AcpiHandler,
-    AmlTable,
-};
+use crate::{fadt::Fadt, hpet::HpetTable, madt::Madt, mcfg::Mcfg, Acpi, AcpiError, AcpiHandler, AmlTable};
 use core::{marker::PhantomData, mem, str};
 use log::{trace, warn};
 use typenum::Unsigned;
@@ -156,8 +147,7 @@ pub(crate) fn peek_at_sdt_header<H>(handler: &mut H, physical_address: usize) ->
 where
     H: AcpiHandler,
 {
-    let mapping =
-        handler.map_physical_region::<SdtHeader>(physical_address, mem::size_of::<SdtHeader>());
+    let mapping = handler.map_physical_region::<SdtHeader>(physical_address, mem::size_of::<SdtHeader>());
     let header = (*mapping).clone();
     handler.unmap_physical_region(mapping);
 
@@ -175,11 +165,7 @@ where
     H: AcpiHandler,
 {
     let header = peek_at_sdt_header(handler, physical_address);
-    trace!(
-        "Found ACPI table with signature {:?} and length {:?}",
-        header.signature(),
-        header.length()
-    );
+    trace!("Found ACPI table with signature {:?} and length {:?}", header.signature(), header.length());
 
     /*
      * For a recognised signature, a new physical mapping should be created with the correct type
@@ -187,15 +173,14 @@ where
      */
     match header.signature() {
         "FACP" => {
-            let fadt_mapping =
-                handler.map_physical_region::<Fadt>(physical_address, mem::size_of::<Fadt>());
+            let fadt_mapping = handler.map_physical_region::<Fadt>(physical_address, mem::size_of::<Fadt>());
             crate::fadt::parse_fadt(acpi, handler, &fadt_mapping)?;
             handler.unmap_physical_region(fadt_mapping);
         }
 
         "HPET" => {
-            let hpet_mapping = handler
-                .map_physical_region::<HpetTable>(physical_address, mem::size_of::<HpetTable>());
+            let hpet_mapping =
+                handler.map_physical_region::<HpetTable>(physical_address, mem::size_of::<HpetTable>());
             crate::hpet::parse_hpet(acpi, &hpet_mapping)?;
             handler.unmap_physical_region(hpet_mapping);
         }

+ 4 - 7
aml_parser/src/name_object.rs

@@ -152,11 +152,9 @@ where
         let (new_input, context, ((), seg_count)) =
             opcode(MULTI_NAME_PREFIX).then(take()).parse(input, context)?;
         match n_of(name_seg(), usize::from(seg_count)).parse(new_input, context) {
-            Ok((new_input, context, name_segs)) => Ok((
-                new_input,
-                context,
-                name_segs.iter().map(|&seg| NameComponent::Segment(seg)).collect(),
-            )),
+            Ok((new_input, context, name_segs)) => {
+                Ok((new_input, context, name_segs.iter().map(|&seg| NameComponent::Segment(seg)).collect()))
+            }
             // Correct returned input to the one we haven't touched
             Err((_, context, err)) => Err((input, context, err)),
         }
@@ -281,8 +279,7 @@ mod tests {
             &[0x2e, b'A']
         );
         check_ok!(
-            name_path()
-                .parse(&[0x2e, b'A', b'B', b'C', b'D', b'E', b'_', b'F', b'G'], &mut context),
+            name_path().parse(&[0x2e, b'A', b'B', b'C', b'D', b'E', b'_', b'F', b'G'], &mut context),
             alloc::vec![
                 NameComponent::Segment(NameSeg([b'A', b'B', b'C', b'D'])),
                 NameComponent::Segment(NameSeg([b'E', b'_', b'F', b'G']))

+ 2 - 7
aml_parser/src/opcode.rs

@@ -60,11 +60,7 @@ mod tests {
     #[test]
     fn empty() {
         let mut context = AmlContext::new();
-        check_err!(
-            opcode(NULL_NAME).parse(&[], &mut context),
-            AmlError::UnexpectedEndOfStream,
-            &[]
-        );
+        check_err!(opcode(NULL_NAME).parse(&[], &mut context), AmlError::UnexpectedEndOfStream, &[]);
         check_err!(
             ext_opcode(EXT_DEF_FIELD_OP).parse(&[], &mut context),
             AmlError::UnexpectedEndOfStream,
@@ -92,8 +88,7 @@ mod tests {
             &[EXT_DEF_FIELD_OP, EXT_DEF_FIELD_OP]
         );
         check_ok!(
-            ext_opcode(EXT_DEF_FIELD_OP)
-                .parse(&[EXT_OPCODE_PREFIX, EXT_DEF_FIELD_OP], &mut context),
+            ext_opcode(EXT_DEF_FIELD_OP).parse(&[EXT_OPCODE_PREFIX, EXT_DEF_FIELD_OP], &mut context),
             (),
             &[]
         );

+ 9 - 28
aml_parser/src/parser.rs

@@ -335,9 +335,7 @@ where
     P: Parser<'a, 'c, R>,
 {
     fn parse(&self, input: &'a [u8], context: &'c mut AmlContext) -> ParseResult<'a, 'c, ()> {
-        self.parser
-            .parse(input, context)
-            .map(|(new_input, new_context, _)| (new_input, new_context, ()))
+        self.parser.parse(input, context).map(|(new_input, new_context, _)| (new_input, new_context, ()))
     }
 }
 
@@ -360,9 +358,9 @@ where
 {
     fn parse(&self, input: &'a [u8], context: &'c mut AmlContext) -> ParseResult<'a, 'c, (R1, R2)> {
         self.p1.parse(input, context).and_then(|(next_input, context, result_a)| {
-            self.p2.parse(next_input, context).map(|(final_input, context, result_b)| {
-                (final_input, context, (result_a, result_b))
-            })
+            self.p2
+                .parse(next_input, context)
+                .map(|(final_input, context, result_b)| (final_input, context, (result_a, result_b)))
         })
     }
 }
@@ -442,11 +440,7 @@ mod tests {
     fn test_take_n() {
         let mut context = AmlContext::new();
         check_err!(take_n(1).parse(&[], &mut context), AmlError::UnexpectedEndOfStream, &[]);
-        check_err!(
-            take_n(2).parse(&[0xf5], &mut context),
-            AmlError::UnexpectedEndOfStream,
-            &[0xf5]
-        );
+        check_err!(take_n(2).parse(&[0xf5], &mut context), AmlError::UnexpectedEndOfStream, &[0xf5]);
 
         check_ok!(take_n(1).parse(&[0xff], &mut context), &[0xff], &[]);
         check_ok!(take_n(1).parse(&[0xff, 0xf8], &mut context), &[0xff], &[0xf8]);
@@ -456,11 +450,7 @@ mod tests {
     #[test]
     fn test_take_ux() {
         let mut context = AmlContext::new();
-        check_err!(
-            take_u16().parse(&[0x34], &mut context),
-            AmlError::UnexpectedEndOfStream,
-            &[0x34]
-        );
+        check_err!(take_u16().parse(&[0x34], &mut context), AmlError::UnexpectedEndOfStream, &[0x34]);
         check_ok!(take_u16().parse(&[0x34, 0x12], &mut context), 0x1234, &[]);
 
         check_err!(
@@ -468,20 +458,11 @@ mod tests {
             AmlError::UnexpectedEndOfStream,
             &[0x34, 0x12]
         );
-        check_ok!(
-            take_u32().parse(&[0x34, 0x12, 0xf4, 0xc3, 0x3e], &mut context),
-            0xc3f41234,
-            &[0x3e]
-        );
+        check_ok!(take_u32().parse(&[0x34, 0x12, 0xf4, 0xc3, 0x3e], &mut context), 0xc3f41234, &[0x3e]);
 
-        check_err!(
-            take_u64().parse(&[0x34], &mut context),
-            AmlError::UnexpectedEndOfStream,
-            &[0x34]
-        );
+        check_err!(take_u64().parse(&[0x34], &mut context), AmlError::UnexpectedEndOfStream, &[0x34]);
         check_ok!(
-            take_u64()
-                .parse(&[0x34, 0x12, 0x35, 0x76, 0xd4, 0x43, 0xa3, 0xb6, 0xff, 0x00], &mut context),
+            take_u64().parse(&[0x34, 0x12, 0x35, 0x76, 0xd4, 0x43, 0xa3, 0xb6, 0xff, 0x00], &mut context),
             0xb6a343d476351234,
             &[0xff, 0x00]
         );

+ 2 - 8
aml_parser/src/pkg_length.rs

@@ -80,9 +80,7 @@ where
                  * The stream was too short. We return an error, making sure to return the
                  * *original* stream (that we haven't consumed any of).
                  */
-                Err((_, context, _)) => {
-                    return Err((input, context, AmlError::UnexpectedEndOfStream))
-                }
+                Err((_, context, _)) => return Err((input, context, AmlError::UnexpectedEndOfStream)),
             };
 
         Ok((new_input, context, length))
@@ -116,11 +114,7 @@ mod tests {
         let mut context = AmlContext::new();
         check_err!(pkg_length().parse(&[], &mut context), AmlError::UnexpectedEndOfStream, &[]);
         test_correct_pkglength(&[0x00], 0, &[]);
-        test_correct_pkglength(
-            &[0x05, 0xf5, 0x7f, 0x3e, 0x54, 0x03],
-            5,
-            &[0xf5, 0x7f, 0x3e, 0x54, 0x03],
-        );
+        test_correct_pkglength(&[0x05, 0xf5, 0x7f, 0x3e, 0x54, 0x03], 5, &[0xf5, 0x7f, 0x3e, 0x54, 0x03]);
         check_err!(
             pkg_length().parse(&[0b11000000, 0xff, 0x4f], &mut context),
             AmlError::UnexpectedEndOfStream,

+ 49 - 74
aml_parser/src/term_object.rs

@@ -77,14 +77,7 @@ where
      */
     comment_scope_verbose(
         "NamedObj",
-        choice!(
-            def_op_region(),
-            def_field(),
-            def_method(),
-            def_device(),
-            def_processor(),
-            def_mutex()
-        ),
+        choice!(def_op_region(), def_field(), def_method(), def_device(), def_processor(), def_mutex()),
     )
 }
 
@@ -98,12 +91,10 @@ where
     opcode(opcode::DEF_NAME_OP)
         .then(comment_scope(
             "DefName",
-            name_string().then(data_ref_object()).map_with_context(
-                |(name, data_ref_object), context| {
-                    context.add_to_namespace(name, AmlValue::Name(box data_ref_object));
-                    (Ok(()), context)
-                },
-            ),
+            name_string().then(data_ref_object()).map_with_context(|(name, data_ref_object), context| {
+                context.add_to_namespace(name, AmlValue::Name(box data_ref_object));
+                (Ok(()), context)
+            }),
         ))
         .discard_result()
 }
@@ -204,32 +195,25 @@ where
     ext_opcode(opcode::EXT_DEF_FIELD_OP)
         .then(comment_scope(
             "DefField",
-            pkg_length().then(name_string()).then(take()).feed(
-                |((list_length, region_name), flags)| {
-                    move |mut input: &'a [u8],
-                          mut context: &'c mut AmlContext|
-                          -> ParseResult<'a, 'c, ()> {
-                        /*
-                         * FieldList := Nothing | <FieldElement FieldList>
-                         */
-                        // TODO: can this pattern be expressed as a combinator
-                        let mut current_offset = 0;
-                        while list_length.still_parsing(input) {
-                            let (new_input, new_context, field_length) = field_element(
-                                region_name.clone(),
-                                FieldFlags::new(flags),
-                                current_offset,
-                            )
-                            .parse(input, context)?;
-                            input = new_input;
-                            context = new_context;
-                            current_offset += field_length;
-                        }
-
-                        Ok((input, context, ()))
+            pkg_length().then(name_string()).then(take()).feed(|((list_length, region_name), flags)| {
+                move |mut input: &'a [u8], mut context: &'c mut AmlContext| -> ParseResult<'a, 'c, ()> {
+                    /*
+                     * FieldList := Nothing | <FieldElement FieldList>
+                     */
+                    // TODO: can this pattern be expressed as a combinator
+                    let mut current_offset = 0;
+                    while list_length.still_parsing(input) {
+                        let (new_input, new_context, field_length) =
+                            field_element(region_name.clone(), FieldFlags::new(flags), current_offset)
+                                .parse(input, context)?;
+                        input = new_input;
+                        context = new_context;
+                        current_offset += field_length;
                     }
-                },
-            ),
+
+                    Ok((input, context, ()))
+                }
+            }),
         ))
         .discard_result()
 }
@@ -266,9 +250,8 @@ where
      * Reserved fields shouldn't actually be added to the namespace; they seem to show gaps in
      * the operation region that aren't used for anything.
      */
-    let reserved_field = opcode(opcode::RESERVED_FIELD)
-        .then(pkg_length())
-        .map(|((), length)| Ok(length.raw_length as u64));
+    let reserved_field =
+        opcode(opcode::RESERVED_FIELD).then(pkg_length()).map(|((), length)| Ok(length.raw_length as u64));
 
     // TODO: work out what to do with an access field
     // let access_field = opcode(opcode::ACCESS_FIELD)
@@ -276,20 +259,19 @@ where
     //     .then(take())
     //     .map_with_context(|(((), access_type), access_attrib), context| (Ok(    , context));
 
-    let named_field =
-        name_seg().then(pkg_length()).map_with_context(move |(name_seg, length), context| {
-            context.add_to_namespace(
-                AmlName::from_name_seg(name_seg),
-                AmlValue::Field {
-                    region: region_name.clone(),
-                    flags,
-                    offset: current_offset,
-                    length: length.raw_length as u64,
-                },
-            );
+    let named_field = name_seg().then(pkg_length()).map_with_context(move |(name_seg, length), context| {
+        context.add_to_namespace(
+            AmlName::from_name_seg(name_seg),
+            AmlValue::Field {
+                region: region_name.clone(),
+                flags,
+                offset: current_offset,
+                length: length.raw_length as u64,
+            },
+        );
 
-            (Ok(length.raw_length as u64), context)
-        });
+        (Ok(length.raw_length as u64), context)
+    });
 
     choice!(reserved_field, named_field)
 }
@@ -311,8 +293,7 @@ where
                 .then(name_string())
                 .then(take())
                 .feed(|((length, name), flags)| {
-                    take_to_end_of_pkglength(length)
-                        .map(move |code| Ok((name.clone(), flags, code)))
+                    take_to_end_of_pkglength(length).map(move |code| Ok((name.clone(), flags, code)))
                 })
                 .map_with_context(|(name, flags, code), context| {
                     context.add_to_namespace(
@@ -345,9 +326,7 @@ where
 
                     (Ok((length, previous_scope)), context)
                 })
-                .feed(|(length, previous_scope)| {
-                    term_list(length).map(move |_| Ok(previous_scope.clone()))
-                })
+                .feed(|(length, previous_scope)| term_list(length).map(move |_| Ok(previous_scope.clone())))
                 .map_with_context(|previous_scope, context| {
                     context.current_scope = previous_scope;
                     (Ok(()), context)
@@ -375,12 +354,10 @@ where
                 .then(take_u32())
                 .then(take())
                 .feed(|((((pkg_length, name), proc_id), pblk_address), pblk_len)| {
-                    term_list(pkg_length)
-                        .map(move |_| Ok((name.clone(), proc_id, pblk_address, pblk_len)))
+                    term_list(pkg_length).map(move |_| Ok((name.clone(), proc_id, pblk_address, pblk_len)))
                 })
                 .map_with_context(|(name, id, pblk_address, pblk_len), context| {
-                    context
-                        .add_to_namespace(name, AmlValue::Processor { id, pblk_address, pblk_len });
+                    context.add_to_namespace(name, AmlValue::Processor { id, pblk_address, pblk_len });
                     (Ok(()), context)
                 }),
         ))
@@ -448,8 +425,7 @@ where
                     let mut package_contents = Vec::new();
 
                     while pkg_length.still_parsing(input) {
-                        let (new_input, new_context, value) =
-                            package_element().parse(input, context)?;
+                        let (new_input, new_context, value) = package_element().parse(input, context)?;
                         input = new_input;
                         context = new_context;
 
@@ -545,12 +521,12 @@ where
             opcode::BYTE_CONST => {
                 take().map(|value| Ok(AmlValue::Integer(value as u64))).parse(new_input, context)
             }
-            opcode::WORD_CONST => take_u16()
-                .map(|value| Ok(AmlValue::Integer(value as u64)))
-                .parse(new_input, context),
-            opcode::DWORD_CONST => take_u32()
-                .map(|value| Ok(AmlValue::Integer(value as u64)))
-                .parse(new_input, context),
+            opcode::WORD_CONST => {
+                take_u16().map(|value| Ok(AmlValue::Integer(value as u64))).parse(new_input, context)
+            }
+            opcode::DWORD_CONST => {
+                take_u32().map(|value| Ok(AmlValue::Integer(value as u64))).parse(new_input, context)
+            }
             opcode::QWORD_CONST => {
                 take_u64().map(|value| Ok(AmlValue::Integer(value))).parse(new_input, context)
             }
@@ -624,8 +600,7 @@ mod test {
             &[0x28]
         );
         check_ok!(
-            computational_data()
-                .parse(&[0x0d, b'A', b'B', b'C', b'D', b'\0', 0xff, 0xf5], &mut context),
+            computational_data().parse(&[0x0d, b'A', b'B', b'C', b'D', b'\0', 0xff, 0xf5], &mut context),
             AmlValue::String(String::from("ABCD")),
             &[0xff, 0xf5]
         );

+ 1 - 3
aml_parser/src/test_utils.rs

@@ -2,9 +2,7 @@ pub(crate) macro check_err($parse: expr, $error: pat, $remains: expr) {
     match $parse {
         Ok(result) => panic!("Expected Err, got {:#?}", result),
         Err((remains, _, $error)) if *remains == *$remains => (),
-        Err((remains, _, $error)) => {
-            panic!("Correct error, incorrect stream returned: {:x?}", remains)
-        }
+        Err((remains, _, $error)) => panic!("Correct error, incorrect stream returned: {:x?}", remains),
         Err((_, _, err)) => panic!("Got wrong error: {:?}", err),
     }
 }

+ 2 - 1
rustfmt.toml

@@ -7,5 +7,6 @@ use_field_init_shorthand = true
 use_try_shorthand = true
 format_doc_comments = true
 wrap_comments = true
-comment_width = 100
+max_width = 110
+comment_width = 110
 use_small_heuristics = "max"