From 37b4ac151b6b53649fcb3f48e6e5df1a206f7db6 Mon Sep 17 00:00:00 2001
From: bjorn3 <bjorn3@users.noreply.github.com>
Date: Sat, 29 Apr 2017 11:45:53 +0200
Subject: [PATCH] Fix some warnings

---
 build.rs              | 7 ++++++-
 src/device/rtc.rs     | 6 ++----
 src/memory/bump.rs    | 1 +
 src/memory/recycle.rs | 2 +-
 src/paging/mod.rs     | 8 ++++----
 5 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/build.rs b/build.rs
index 117deebe..8c04b16d 100644
--- a/build.rs
+++ b/build.rs
@@ -102,7 +102,12 @@ mod gen {
 
     match src {
         Ok(v) => fill_from_location(&mut f, Path::new(&v)).unwrap(),
-        Err(e) => println!("cargo:warning=location not found: {}, please set proper INITFS_FOLDER.", e),
+        Err(e) => {
+            f.write_all(
+b"        files.clear();" // Silence mutability warning
+).unwrap();
+            println!("cargo:warning=location not found: {}, please set proper INITFS_FOLDER.", e);
+        }
     }
 
     f.write_all(b"        files
diff --git a/src/device/rtc.rs b/src/device/rtc.rs
index 4a0b384f..29ff7f76 100644
--- a/src/device/rtc.rs
+++ b/src/device/rtc.rs
@@ -1,8 +1,6 @@
 use syscall::io::{Io, Pio};
 use time;
 
-use acpi;
-
 pub fn init() {
     let mut rtc = Rtc::new();
     time::START.lock().0 = rtc.time();
@@ -50,11 +48,11 @@ impl Rtc {
         let mut century;
         let register_b;
 
-        let century_register = if let Some(ref fadt) = acpi::ACPI_TABLE.lock().fadt {
+        /*let century_register = if let Some(ref fadt) = acpi::ACPI_TABLE.lock().fadt {
             Some(fadt.century)
         } else {
             None
-        };
+        };*/
 
         unsafe {
             self.wait();
diff --git a/src/memory/bump.rs b/src/memory/bump.rs
index 6453b108..0cdbf0a0 100644
--- a/src/memory/bump.rs
+++ b/src/memory/bump.rs
@@ -43,6 +43,7 @@ impl BumpAllocator {
 }
 
 impl FrameAllocator for BumpAllocator {
+    #[allow(unused)]
     fn set_noncore(&mut self, noncore: bool) {}
     
     fn free_frames(&self) -> usize {
diff --git a/src/memory/recycle.rs b/src/memory/recycle.rs
index f006ec59..21e08313 100644
--- a/src/memory/recycle.rs
+++ b/src/memory/recycle.rs
@@ -5,7 +5,7 @@ use collections::Vec;
 
 use paging::PhysicalAddress;
 
-use super::{Frame, FrameAllocator, MemoryArea, MemoryAreaIter};
+use super::{Frame, FrameAllocator};
 
 pub struct RecycleAllocator<T: FrameAllocator> {
     inner: T,
diff --git a/src/paging/mod.rs b/src/paging/mod.rs
index 2462fb9a..c293d55d 100644
--- a/src/paging/mod.rs
+++ b/src/paging/mod.rs
@@ -130,7 +130,7 @@ pub unsafe fn init(cpu_id: usize, stack_start: usize, stack_end: usize) -> (Acti
             for page in Page::range_inclusive(start_page, end_page) {
                 let result = mapper.map(page, PRESENT | GLOBAL | NO_EXECUTE | WRITABLE);
                 // The flush can be ignored as this is not the active table. See later active_table.switch
-                unsafe { result.ignore(); }
+                result.ignore();
             }
         }
 
@@ -142,7 +142,7 @@ pub unsafe fn init(cpu_id: usize, stack_start: usize, stack_end: usize) -> (Acti
                     let page = Page::containing_address(VirtualAddress::new(frame.start_address().get() + ::KERNEL_OFFSET));
                     let result = mapper.map_to(page, frame, flags);
                     // The flush can be ignored as this is not the active table. See later active_table.switch
-                    unsafe { result.ignore(); }
+                    result.ignore();
                 }
             }
         };
@@ -206,7 +206,7 @@ pub unsafe fn init_ap(cpu_id: usize, bsp_table: usize, stack_start: usize, stack
             for page in Page::range_inclusive(start_page, end_page) {
                 let result = mapper.map(page, PRESENT | GLOBAL | NO_EXECUTE | WRITABLE);
                 // The flush can be ignored as this is not the active table. See later active_table.switch
-                unsafe { result.ignore(); }
+                result.ignore();
             }
         }
 
@@ -218,7 +218,7 @@ pub unsafe fn init_ap(cpu_id: usize, bsp_table: usize, stack_start: usize, stack
                     let page = Page::containing_address(VirtualAddress::new(frame.start_address().get() + ::KERNEL_OFFSET));
                     let result = mapper.map_to(page, frame, flags);
                     // The flush can be ignored as this is not the active table. See later active_table.switch
-                    unsafe { result.ignore(); }
+                    result.ignore();
                 }
             }
         };
-- 
GitLab