Merge pull request #1019 from matthiasbeyer/fix-warnings

Fix warnings by not allowing them anymore
This commit is contained in:
Matthias Beyer 2017-08-27 21:14:00 +02:00 committed by GitHub
commit b2d6a881b0
25 changed files with 132 additions and 18 deletions

View file

@ -18,6 +18,7 @@
// //
#![deny( #![deny(
dead_code,
non_camel_case_types, non_camel_case_types,
non_snake_case, non_snake_case,
path_statements, path_statements,
@ -26,6 +27,7 @@
unused_allocation, unused_allocation,
unused_import_braces, unused_import_braces,
unused_imports, unused_imports,
unused_must_use,
unused_mut, unused_mut,
unused_qualifications, unused_qualifications,
while_true, while_true,

View file

@ -18,6 +18,7 @@
// //
#![deny( #![deny(
dead_code,
non_camel_case_types, non_camel_case_types,
non_snake_case, non_snake_case,
path_statements, path_statements,
@ -26,6 +27,7 @@
unused_allocation, unused_allocation,
unused_import_braces, unused_import_braces,
unused_imports, unused_imports,
unused_must_use,
unused_mut, unused_mut,
unused_qualifications, unused_qualifications,
while_true, while_true,

View file

@ -18,6 +18,7 @@
// //
#![deny( #![deny(
dead_code,
non_camel_case_types, non_camel_case_types,
non_snake_case, non_snake_case,
path_statements, path_statements,
@ -26,6 +27,7 @@
unused_allocation, unused_allocation,
unused_import_braces, unused_import_braces,
unused_imports, unused_imports,
unused_must_use,
unused_mut, unused_mut,
unused_qualifications, unused_qualifications,
while_true, while_true,

View file

@ -18,6 +18,7 @@
// //
#![deny( #![deny(
dead_code,
non_camel_case_types, non_camel_case_types,
non_snake_case, non_snake_case,
path_statements, path_statements,
@ -26,6 +27,7 @@
unused_allocation, unused_allocation,
unused_import_braces, unused_import_braces,
unused_imports, unused_imports,
unused_must_use,
unused_mut, unused_mut,
unused_qualifications, unused_qualifications,
while_true, while_true,

View file

@ -17,6 +17,22 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
// //
#![deny(
dead_code,
non_camel_case_types,
non_snake_case,
path_statements,
trivial_numeric_casts,
unstable_features,
unused_allocation,
unused_import_braces,
unused_imports,
unused_must_use,
unused_mut,
unused_qualifications,
while_true,
)]
#[macro_use] extern crate log; #[macro_use] extern crate log;
extern crate email; extern crate email;
extern crate semver; extern crate semver;

View file

@ -53,6 +53,7 @@ impl<'a> Mail<'a> {
/// Imports a mail from the Path passed /// Imports a mail from the Path passed
pub fn import_from_path<P: AsRef<Path>>(store: &Store, p: P) -> Result<Mail> { pub fn import_from_path<P: AsRef<Path>>(store: &Store, p: P) -> Result<Mail> {
debug!("Importing Mail from path");
let h = MailHasher::new(); let h = MailHasher::new();
let f = RefFlags::default().with_content_hashing(true).with_permission_tracking(false); let f = RefFlags::default().with_content_hashing(true).with_permission_tracking(false);
let p = PathBuf::from(p.as_ref()); let p = PathBuf::from(p.as_ref());
@ -60,6 +61,7 @@ impl<'a> Mail<'a> {
Ref::create_with_hasher(store, p, f, h) Ref::create_with_hasher(store, p, f, h)
.map_err_into(MEK::RefCreationError) .map_err_into(MEK::RefCreationError)
.and_then(|reference| { .and_then(|reference| {
debug!("Build reference file: {:?}", reference);
reference.fs_file() reference.fs_file()
.map_err_into(MEK::RefHandlingError) .map_err_into(MEK::RefHandlingError)
.and_then(|path| File::open(path).map_err_into(MEK::IOError)) .and_then(|path| File::open(path).map_err_into(MEK::IOError))
@ -76,6 +78,7 @@ impl<'a> Mail<'a> {
/// Opens a mail by the passed hash /// Opens a mail by the passed hash
pub fn open<S: AsRef<str>>(store: &Store, hash: S) -> Result<Option<Mail>> { pub fn open<S: AsRef<str>>(store: &Store, hash: S) -> Result<Option<Mail>> {
debug!("Opening Mail by Hash");
Ref::get_by_hash(store, String::from(hash.as_ref())) Ref::get_by_hash(store, String::from(hash.as_ref()))
.map_err_into(MEK::FetchByHashError) .map_err_into(MEK::FetchByHashError)
.map_err_into(MEK::FetchError) .map_err_into(MEK::FetchError)
@ -88,6 +91,7 @@ impl<'a> Mail<'a> {
/// Implement me as TryFrom as soon as it is stable /// Implement me as TryFrom as soon as it is stable
pub fn from_ref(r: Ref<'a>) -> Result<Mail> { pub fn from_ref(r: Ref<'a>) -> Result<Mail> {
debug!("Building Mail object from Ref: {:?}", r);
r.fs_file() r.fs_file()
.map_err_into(MEK::RefHandlingError) .map_err_into(MEK::RefHandlingError)
.and_then(|path| File::open(path).map_err_into(MEK::IOError)) .and_then(|path| File::open(path).map_err_into(MEK::IOError))
@ -102,6 +106,7 @@ impl<'a> Mail<'a> {
} }
pub fn get_field(&self, field: &str) -> Result<Option<String>> { pub fn get_field(&self, field: &str) -> Result<Option<String>> {
debug!("Getting field in mail: {:?}", field);
self.1 self.1
.parsed() .parsed()
.map_err_into(MEK::MailParsingError) .map_err_into(MEK::MailParsingError)

View file

@ -17,10 +17,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
// //
use result::Result;
use chrono::NaiveDateTime; use chrono::NaiveDateTime;
use filters::filter::Filter;
use libimagstore::store::FileLockEntry; use libimagstore::store::FileLockEntry;

View file

@ -30,10 +30,7 @@ mod test {
use libimagstore::store::Store; use libimagstore::store::Store;
use super::create::*;
use super::get::*;
use super::setendtime::*; use super::setendtime::*;
use super::storeid::*;
use super::tag::*; use super::tag::*;
fn get_store() -> Store { fn get_store() -> Store {
@ -53,7 +50,7 @@ mod test {
let iter = tags.into_iter().map(String::from); let iter = tags.into_iter().map(String::from);
let iter : SetEndTimeIter = TagIter::new(Box::new(iter)) let _ : SetEndTimeIter = TagIter::new(Box::new(iter))
.create_storeids(now) .create_storeids(now)
.create_entries(&store) .create_entries(&store)
.set_end_time(then); .set_end_time(then);

View file

@ -17,6 +17,22 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
// //
#![deny(
dead_code,
non_camel_case_types,
non_snake_case,
path_statements,
trivial_numeric_casts,
unstable_features,
unused_allocation,
unused_import_braces,
unused_imports,
unused_must_use,
unused_mut,
unused_qualifications,
while_true,
)]
extern crate filters; extern crate filters;
extern crate chrono; extern crate chrono;
extern crate toml; extern crate toml;

View file

@ -22,7 +22,8 @@ generate_error_module!(
ConversionError => "Conversion Error", ConversionError => "Conversion Error",
StoreError => "Store Error", StoreError => "Store Error",
StoreIdError => "Store Id handling error", StoreIdError => "Store Id handling error",
ImportError => "Error importing" ImportError => "Error importing",
UTF8Error => "Encountered non-UTF8 characters while reading input"
); );
); );

View file

@ -18,6 +18,7 @@
// //
#![deny( #![deny(
dead_code,
non_camel_case_types, non_camel_case_types,
non_snake_case, non_snake_case,
path_statements, path_statements,
@ -26,6 +27,7 @@
unused_allocation, unused_allocation,
unused_import_braces, unused_import_braces,
unused_imports, unused_imports,
unused_must_use,
unused_mut, unused_mut,
unused_qualifications, unused_qualifications,
while_true, while_true,

View file

@ -48,7 +48,7 @@ impl<'a> Task<'a> {
pub fn import<R: BufRead>(store: &'a Store, mut r: R) -> Result<(Task<'a>, String, Uuid)> { pub fn import<R: BufRead>(store: &'a Store, mut r: R) -> Result<(Task<'a>, String, Uuid)> {
let mut line = String::new(); let mut line = String::new();
r.read_line(&mut line); try!(r.read_line(&mut line).map_err_into(TEK::UTF8Error));
import_task(&line.as_str()) import_task(&line.as_str())
.map_err_into(TEK::ImportError) .map_err_into(TEK::ImportError)
.and_then(|t| { .and_then(|t| {
@ -70,7 +70,7 @@ impl<'a> Task<'a> {
where R: BufRead where R: BufRead
{ {
let mut line = String::new(); let mut line = String::new();
r.read_line(&mut line); try!(r.read_line(&mut line).map_err_into(TEK::UTF8Error));
Task::get_from_string(store, line) Task::get_from_string(store, line)
} }
@ -104,7 +104,7 @@ impl<'a> Task<'a> {
/// implicitely create the task if it does not exist. /// implicitely create the task if it does not exist.
pub fn retrieve_from_import<R: BufRead>(store: &'a Store, mut r: R) -> Result<Task<'a>> { pub fn retrieve_from_import<R: BufRead>(store: &'a Store, mut r: R) -> Result<Task<'a>> {
let mut line = String::new(); let mut line = String::new();
r.read_line(&mut line); try!(r.read_line(&mut line).map_err_into(TEK::UTF8Error));
Task::retrieve_from_string(store, line) Task::retrieve_from_string(store, line)
} }

View file

@ -17,11 +17,27 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
// //
#![deny(
dead_code,
non_camel_case_types,
non_snake_case,
path_statements,
trivial_numeric_casts,
unstable_features,
unused_allocation,
unused_import_braces,
unused_imports,
unused_must_use,
unused_mut,
unused_qualifications,
while_true,
)]
extern crate uuid; extern crate uuid;
extern crate toml; extern crate toml;
#[macro_use] extern crate libimagerror; #[macro_use] extern crate libimagerror;
#[macro_use] extern crate libimagstore; extern crate libimagstore;
extern crate libimagentrylink; extern crate libimagentrylink;
extern crate libimagnotes; extern crate libimagnotes;
extern crate libimagutil; extern crate libimagutil;

View file

@ -17,6 +17,22 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
// //
#![deny(
dead_code,
non_camel_case_types,
non_snake_case,
path_statements,
trivial_numeric_casts,
unstable_features,
unused_allocation,
unused_import_braces,
unused_imports,
unused_must_use,
unused_mut,
unused_qualifications,
while_true,
)]
extern crate toml_query; extern crate toml_query;
extern crate toml; extern crate toml;
#[macro_use] #[macro_use]

View file

@ -23,6 +23,3 @@ libimagerror = { version = "0.4.0", path = "../../../lib/core/libimagerror" }
libimagstore = { version = "0.4.0", path = "../../../lib/core/libimagstore" } libimagstore = { version = "0.4.0", path = "../../../lib/core/libimagstore" }
libimagutil = { version = "0.4.0", path = "../../../lib/etc/libimagutil" } libimagutil = { version = "0.4.0", path = "../../../lib/etc/libimagutil" }
[dev-dependencies]
is-match = "0.1"

View file

@ -17,6 +17,22 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
// //
#![deny(
dead_code,
non_camel_case_types,
non_snake_case,
path_statements,
trivial_numeric_casts,
unstable_features,
unused_allocation,
unused_import_braces,
unused_imports,
unused_must_use,
unused_mut,
unused_qualifications,
while_true,
)]
#[macro_use] extern crate lazy_static; #[macro_use] extern crate lazy_static;
extern crate chrono; extern crate chrono;
extern crate toml_query; extern crate toml_query;
@ -26,9 +42,6 @@ extern crate toml;
extern crate libimagstore; extern crate libimagstore;
extern crate libimagutil; extern crate libimagutil;
#[cfg(test)]
#[macro_use] extern crate is_match;
pub mod datepath; pub mod datepath;
pub mod datetime; pub mod datetime;
pub mod error; pub mod error;

View file

@ -17,6 +17,22 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
// //
#![deny(
dead_code,
non_camel_case_types,
non_snake_case,
path_statements,
trivial_numeric_casts,
unstable_features,
unused_allocation,
unused_import_braces,
unused_imports,
unused_must_use,
unused_mut,
unused_qualifications,
while_true,
)]
#[macro_use] extern crate libimagerror; #[macro_use] extern crate libimagerror;
extern crate libimagstore; extern crate libimagstore;
extern crate libimagrt; extern crate libimagrt;

View file

@ -18,6 +18,7 @@
// //
#![deny( #![deny(
dead_code,
non_camel_case_types, non_camel_case_types,
non_snake_case, non_snake_case,
path_statements, path_statements,

View file

@ -18,6 +18,7 @@
// //
#![deny( #![deny(
dead_code,
non_camel_case_types, non_camel_case_types,
non_snake_case, non_snake_case,
path_statements, path_statements,
@ -26,6 +27,7 @@
unused_allocation, unused_allocation,
unused_import_braces, unused_import_braces,
unused_imports, unused_imports,
unused_must_use,
unused_mut, unused_mut,
unused_qualifications, unused_qualifications,
while_true, while_true,

View file

@ -18,6 +18,7 @@
// //
#![deny( #![deny(
dead_code,
non_camel_case_types, non_camel_case_types,
non_snake_case, non_snake_case,
path_statements, path_statements,
@ -26,6 +27,7 @@
unused_allocation, unused_allocation,
unused_import_braces, unused_import_braces,
unused_imports, unused_imports,
unused_must_use,
unused_mut, unused_mut,
unused_qualifications, unused_qualifications,
while_true, while_true,

View file

@ -18,6 +18,7 @@
// //
#![deny( #![deny(
dead_code,
non_camel_case_types, non_camel_case_types,
non_snake_case, non_snake_case,
path_statements, path_statements,
@ -26,6 +27,7 @@
unused_allocation, unused_allocation,
unused_import_braces, unused_import_braces,
unused_imports, unused_imports,
unused_must_use,
unused_mut, unused_mut,
unused_qualifications, unused_qualifications,
while_true, while_true,

View file

@ -18,6 +18,7 @@
// //
#![deny( #![deny(
dead_code,
non_camel_case_types, non_camel_case_types,
non_snake_case, non_snake_case,
path_statements, path_statements,
@ -26,6 +27,7 @@
unused_allocation, unused_allocation,
unused_import_braces, unused_import_braces,
unused_imports, unused_imports,
unused_must_use,
unused_mut, unused_mut,
unused_qualifications, unused_qualifications,
while_true, while_true,

View file

@ -18,6 +18,7 @@
// //
#![deny( #![deny(
dead_code,
non_camel_case_types, non_camel_case_types,
non_snake_case, non_snake_case,
path_statements, path_statements,
@ -26,6 +27,7 @@
unused_allocation, unused_allocation,
unused_import_braces, unused_import_braces,
unused_imports, unused_imports,
unused_must_use,
unused_mut, unused_mut,
unused_qualifications, unused_qualifications,
while_true, while_true,

View file

@ -18,6 +18,7 @@
// //
#![deny( #![deny(
dead_code,
non_camel_case_types, non_camel_case_types,
non_snake_case, non_snake_case,
path_statements, path_statements,
@ -26,6 +27,7 @@
unused_allocation, unused_allocation,
unused_import_braces, unused_import_braces,
unused_imports, unused_imports,
unused_must_use,
unused_mut, unused_mut,
unused_qualifications, unused_qualifications,
while_true, while_true,

View file

@ -18,6 +18,7 @@
// //
#![deny( #![deny(
dead_code,
non_camel_case_types, non_camel_case_types,
non_snake_case, non_snake_case,
path_statements, path_statements,