浏览代码

Merge #38

38: #37 Run `cargo fix --edition` & `cargo fmt` to update crate for rust 2018 r=IsaacWoods a=Atul9

closes #37 

Co-authored-by: Atul Bhosale <atul1bhosale@gmail.com>
bors[bot] 6 年之前
父节点
当前提交
a955ebd1bc
共有 9 个文件被更改,包括 36 次插入35 次删除
  1. 1 0
      Cargo.toml
  2. 2 2
      src/aml/mod.rs
  3. 2 2
      src/aml/parser.rs
  4. 4 4
      src/fadt.rs
  5. 2 2
      src/hpet.rs
  6. 8 8
      src/lib.rs
  7. 7 7
      src/madt.rs
  8. 3 3
      src/rsdp_search.rs
  9. 7 7
      src/sdt.rs

+ 1 - 0
Cargo.toml

@@ -6,6 +6,7 @@ repository = "https://github.com/rust-osdev/acpi"
 description = "Library for parsing ACPI tables and AML"
 readme = "README.md"
 license = "MIT/Apache-2.0"
+edition = "2018"
 
 [dependencies]
 log = "0.*"

+ 2 - 2
src/aml/mod.rs

@@ -7,10 +7,10 @@ pub use self::value::AmlValue;
 
 use self::parser::AmlParser;
 use self::stream::AmlStream;
+use crate::sdt::SdtHeader;
+use crate::{Acpi, AcpiError, AcpiHandler, PhysicalMapping};
 use alloc::string::String;
 use core::{mem, slice};
-use sdt::SdtHeader;
-use {Acpi, AcpiError, AcpiHandler, PhysicalMapping};
 
 /// Represents a table containing AML. For ACPI Version 2+, this is just the DSDT and SSDTs.
 /// Version 1.0 may also have a PSDT.

+ 2 - 2
src/aml/parser.rs

@@ -1,10 +1,10 @@
 use super::stream::AmlStream;
 use super::value::{AmlValue, FieldFlags, RegionSpace};
 use super::{opcodes, AmlError};
+use crate::{Acpi, AcpiHandler};
 use alloc::string::String;
 use bit_field::BitField;
 use core::str;
-use {Acpi, AcpiHandler};
 
 /// This is used internally by the parser to keep track of what we know about a field before we can
 /// add it to the namespace.
@@ -159,7 +159,7 @@ where
         let containing_scope = self.scope.clone();
 
         self.scope = name_string;
-        let term_list = self.parse_term_list(scope_end_offset)?;
+        let _term_list = self.parse_term_list(scope_end_offset)?;
         self.scope = containing_scope;
 
         Ok(())

+ 4 - 4
src/fadt.rs

@@ -1,7 +1,7 @@
-use aml::{parse_aml_table, AmlTable};
-use sdt;
-use sdt::SdtHeader;
-use {Acpi, AcpiError, AcpiHandler, GenericAddress, PhysicalMapping};
+use crate::aml::{parse_aml_table, AmlTable};
+use crate::sdt;
+use crate::sdt::SdtHeader;
+use crate::{Acpi, AcpiError, AcpiHandler, GenericAddress, PhysicalMapping};
 
 /// Represents the Fixed ACPI Description Table (FADT). This table contains various fixed hardware
 /// details, such as the addresses of the hardware register blocks. It also contains a pointer to

+ 2 - 2
src/hpet.rs

@@ -1,5 +1,5 @@
-use sdt::SdtHeader;
-use {AcpiError, GenericAddress, PhysicalMapping};
+use crate::sdt::SdtHeader;
+use crate::{AcpiError, GenericAddress, PhysicalMapping};
 
 #[repr(C, packed)]
 pub struct Hpet {

+ 8 - 8
src/lib.rs

@@ -22,18 +22,18 @@ mod rsdp;
 mod rsdp_search;
 mod sdt;
 
-pub use aml::AmlError;
-pub use madt::MadtError;
-pub use rsdp_search::search_for_rsdp_bios;
-
+pub use crate::aml::AmlError;
+pub use crate::madt::MadtError;
+pub use crate::rsdp_search::search_for_rsdp_bios;
+
+use crate::aml::AmlValue;
+use crate::interrupt::InterruptModel;
+use crate::rsdp::Rsdp;
+use crate::sdt::SdtHeader;
 use alloc::{collections::BTreeMap, string::String, vec::Vec};
-use aml::AmlValue;
 use core::mem;
 use core::ops::Deref;
 use core::ptr::NonNull;
-use interrupt::InterruptModel;
-use rsdp::Rsdp;
-use sdt::SdtHeader;
 
 #[derive(Debug)]
 // TODO: manually implement Debug to print signatures correctly etc.

+ 7 - 7
src/madt.rs

@@ -1,12 +1,12 @@
+use crate::interrupt::{
+    InterruptModel, InterruptSourceOverride, IoApic, NmiSource, Polarity, TriggerMode,
+};
+use crate::sdt::SdtHeader;
+use crate::{Acpi, AcpiError, AcpiHandler, PhysicalMapping, Processor, ProcessorState};
 use alloc::vec::Vec;
 use bit_field::BitField;
 use core::marker::PhantomData;
 use core::mem;
-use interrupt::{
-    InterruptModel, InterruptSourceOverride, IoApic, NmiSource, Polarity, TriggerMode,
-};
-use sdt::SdtHeader;
-use {Acpi, AcpiError, AcpiHandler, PhysicalMapping, Processor, ProcessorState};
 
 #[derive(Debug)]
 pub enum MadtError {
@@ -328,7 +328,7 @@ struct GicInterruptTranslationServiceEntry {
 
 pub(crate) fn parse_madt<H>(
     acpi: &mut Acpi,
-    handler: &mut H,
+    _handler: &mut H,
     mapping: &PhysicalMapping<Madt>,
 ) -> Result<(), AcpiError>
 where
@@ -390,7 +390,7 @@ fn parse_apic_model(
     acpi: &mut Acpi,
     mapping: &PhysicalMapping<Madt>,
 ) -> Result<InterruptModel, AcpiError> {
-    use interrupt::LocalInterruptLine;
+    use crate::interrupt::LocalInterruptLine;
 
     let mut local_apic_address = (*mapping).local_apic_address as u64;
     let mut io_apics = Vec::new();

+ 3 - 3
src/rsdp_search.rs

@@ -1,7 +1,7 @@
+use crate::rsdp::Rsdp;
+use crate::Acpi;
+use crate::{parse_validated_rsdp, AcpiError, AcpiHandler};
 use core::{mem, ops::RangeInclusive};
-use rsdp::Rsdp;
-use Acpi;
-use {parse_validated_rsdp, AcpiError, AcpiHandler};
 
 /// The pointer to the EBDA (Extended Bios Data Area) start segment pointer
 const EBDA_START_SEGMENT_PTR: usize = 0x40e;

+ 7 - 7
src/sdt.rs

@@ -1,8 +1,8 @@
+use crate::fadt::Fadt;
+use crate::hpet::Hpet;
+use crate::madt::Madt;
+use crate::{Acpi, AcpiError, AcpiHandler};
 use core::{mem, str};
-use fadt::Fadt;
-use hpet::Hpet;
-use madt::Madt;
-use {Acpi, AcpiError, AcpiHandler};
 
 /// All SDTs share the same header, and are `length` bytes long. The signature tells us which SDT
 /// this is.
@@ -154,21 +154,21 @@ where
         "FACP" => {
             let fadt_mapping =
                 handler.map_physical_region::<Fadt>(physical_address, mem::size_of::<Fadt>());
-            ::fadt::parse_fadt(acpi, handler, &fadt_mapping)?;
+            crate::fadt::parse_fadt(acpi, handler, &fadt_mapping)?;
             handler.unmap_physical_region(fadt_mapping);
         }
 
         "HPET" => {
             let hpet_mapping =
                 handler.map_physical_region::<Hpet>(physical_address, mem::size_of::<Hpet>());
-            ::hpet::parse_hpet(&hpet_mapping)?;
+            crate::hpet::parse_hpet(&hpet_mapping)?;
             handler.unmap_physical_region(hpet_mapping);
         }
 
         "APIC" => {
             let madt_mapping =
                 handler.map_physical_region::<Madt>(physical_address, header.length() as usize);
-            ::madt::parse_madt(acpi, handler, &madt_mapping)?;
+            crate::madt::parse_madt(acpi, handler, &madt_mapping)?;
             handler.unmap_physical_region(madt_mapping);
         }