From c8a15bc79b57bdf25e5002fffd3f90d0a1d87cc3 Mon Sep 17 00:00:00 2001 From: niluxv Date: Fri, 3 Jul 2020 19:01:39 +0200 Subject: [PATCH] Add some clippy lints and remove commented `inner_load` --- src/backend/mmap.rs | 2 +- src/lib.rs | 23 ++++++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/backend/mmap.rs b/src/backend/mmap.rs index bc0359f..a7883ac 100644 --- a/src/backend/mmap.rs +++ b/src/backend/mmap.rs @@ -50,7 +50,7 @@ impl Mmap { self.inner.flush() } - /// Increases mmap size by max(old_size*2, new_size). + /// Increases mmap size by `max(old_size*2, new_size)`. /// /// Note that it doesn't copy original data fn resize_no_copy(&mut self, new_size: usize) -> io::Result<()> { diff --git a/src/lib.rs b/src/lib.rs index e87d202..8cf2d53 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,6 +17,19 @@ unused_must_use, unused_mut, while_true, + clippy::panic, + clippy::print_stdout, + clippy::todo, + clippy::unwrap_used, + clippy::wrong_pub_self_convention, +)] + +#![warn(clippy::pedantic)] + +// part of `clippy::pedantic`, causing many warnings +#![allow( + clippy::missing_errors_doc, + clippy::module_name_repetitions )] //! # Rustbreak @@ -214,7 +227,7 @@ use crate::backend::MmapStorage; /// /// - `Data`: Is the Data, you must specify this /// - `Back`: The storage backend. -/// - `DeSer`: The Serializer/Deserializer or short DeSer. Check the [`deser`] module for other +/// - `DeSer`: The Serializer/Deserializer or short `DeSer`. Check the [`deser`] module for other /// strategies. /// /// # Panics @@ -490,14 +503,6 @@ impl Database self.data.write().map_err(|_| error::RustbreakErrorKind::Poison.into()) } -// // Now replaced by [`load_get_data_lock`]. -// fn inner_load(backend: &mut Back, deser: &DeSer) -> error::Result { -// let new_data = deser.deserialize( -// &backend.get_data().context(error::RustbreakErrorKind::Backend)?[..] -// ).context(error::RustbreakErrorKind::Deserialization)?; -// -// Ok(new_data) -// } /// Like [`Self::load`] but returns the write lock to data it used. fn load_get_data_lock(&self) -> error::Result> {