diff --git a/src/error.rs b/src/error.rs index a6ad7af..69d5291 100644 --- a/src/error.rs +++ b/src/error.rs @@ -6,9 +6,9 @@ quick_error! { pub enum BreakError { /// An error returned when doing file operations, this might happen by opening, closing, /// locking or flushing - Io(err: ::std::io::Error) { - from() - } + Io(err: ::std::io::Error) { + from() + } /// This error happens if Bincode cannot deserialize a given file. If you get this error /// check your database is not corrupt. (This includes non-empty files **not** created by /// RustBreak! diff --git a/src/lib.rs b/src/lib.rs index a30610a..bf92e00 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -104,7 +104,7 @@ pub type BreakResult = Result; /// ]; /// /// for (album, artist) in albums { -/// db.insert(&format!("album_{}",album), artist).unwrap(); +/// db.insert(&format!("album_{}",album), artist).unwrap(); /// } /// db.flush().unwrap(); /// ``` @@ -133,20 +133,20 @@ impl Database { /// ]; /// /// for (album, artist) in albums { - /// db.insert(&format!("album_{}",album), artist).unwrap(); + /// db.insert(&format!("album_{}",album), artist).unwrap(); /// } /// db.flush().unwrap(); /// ``` pub fn open>(path: P) -> BreakResult> { - use std::fs::OpenOptions; - use fs2::FileExt; + use std::fs::OpenOptions; + use fs2::FileExt; use std::io::Read; use bincode::serde::deserialize; - let mut file = try!(OpenOptions::new().read(true).write(true).create(true).open(path)); - try!(file.try_lock_exclusive()); + let mut file = try!(OpenOptions::new().read(true).write(true).create(true).open(path)); + try!(file.try_lock_exclusive()); - let mut buf = Vec::new(); + let mut buf = Vec::new(); try!(file.read_to_end(&mut buf)); let map : HashMap> = if !buf.is_empty() { try!(deserialize(&buf))