From e2216db41d78de3a22df3547812aa4c6f122bdf0 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Tue, 27 Aug 2019 11:55:40 +0200 Subject: [PATCH] Allow some Clippy lints Signed-off-by: flip1995 Signed-off-by: Matthias Beyer --- bin/domain/imag-contact/src/create.rs | 1 + lib/domain/libimagbookmark/src/collection.rs | 2 ++ lib/entry/libimagentrydatetime/src/datetime.rs | 3 +++ lib/entry/libimagentrydatetime/src/range.rs | 4 ++++ lib/entry/libimagentrylink/src/linkable.rs | 1 + 5 files changed, 11 insertions(+) diff --git a/bin/domain/imag-contact/src/create.rs b/bin/domain/imag-contact/src/create.rs index ff8e2392..bcd87730 100644 --- a/bin/domain/imag-contact/src/create.rs +++ b/bin/domain/imag-contact/src/create.rs @@ -232,6 +232,7 @@ pub fn create(rt: &Runtime) { info!("Ready"); } +#[clippy::cognitive_complexity = "71"] fn parse_toml_into_vcard(output: &mut dyn Write, input: &mut dyn Read, toml: Value, uuid: String) -> Option { let mut vcard = VcardBuilder::new().with_uid(uuid); diff --git a/lib/domain/libimagbookmark/src/collection.rs b/lib/domain/libimagbookmark/src/collection.rs index 0fc85b79..a50208ad 100644 --- a/lib/domain/libimagbookmark/src/collection.rs +++ b/lib/domain/libimagbookmark/src/collection.rs @@ -51,6 +51,7 @@ pub trait BookmarkCollectionStore<'a> { impl<'a> BookmarkCollectionStore<'a> for Store { + #[allow(clippy::new_ret_no_self)] fn new(&'a self, name: &str) -> Result> { crate::module_path::new_id(name) .and_then(|id| self.create(id) @@ -94,6 +95,7 @@ impl BookmarkCollection for Entry { self.get_urls(store) } + #[allow(clippy::redundant_closure)] fn link_entries(&self) -> Result> { use libimagentryurl::util::is_external_link_storeid; self.links().map(|v| v.filter(|id| is_external_link_storeid(id)).collect()) diff --git a/lib/entry/libimagentrydatetime/src/datetime.rs b/lib/entry/libimagentrydatetime/src/datetime.rs index 8c7555b7..46604a52 100644 --- a/lib/entry/libimagentrydatetime/src/datetime.rs +++ b/lib/entry/libimagentrydatetime/src/datetime.rs @@ -228,6 +228,7 @@ mod tests { fn test_set_date() { let store = get_store(); + #[allow(clippy::zero_prefixed_literal)] let date = { let date = NaiveDate::from_ymd(2000, 01, 02); let time = NaiveTime::from_hms(03, 04, 05); @@ -260,6 +261,7 @@ mod tests { } #[test] + #[allow(clippy::zero_prefixed_literal)] fn test_read_date() { use chrono::Datelike; use chrono::Timelike; @@ -300,6 +302,7 @@ mod tests { fn test_delete_date() { let store = get_store(); + #[allow(clippy::zero_prefixed_literal)] let date = { let date = NaiveDate::from_ymd(2000, 01, 02); let time = NaiveTime::from_hms(03, 04, 05); diff --git a/lib/entry/libimagentrydatetime/src/range.rs b/lib/entry/libimagentrydatetime/src/range.rs index 33a77691..8c2825db 100644 --- a/lib/entry/libimagentrydatetime/src/range.rs +++ b/lib/entry/libimagentrydatetime/src/range.rs @@ -56,11 +56,13 @@ mod tests { #[test] fn test_new_returns_error_if_start_after_end_date() { + #[allow(clippy::zero_prefixed_literal)] let start = NaiveDateTime::new( NaiveDate::from_ymd(2000, 02, 02), NaiveTime::from_hms(12, 00, 02) ); + #[allow(clippy::zero_prefixed_literal)] let end = NaiveDateTime::new( NaiveDate::from_ymd(2000, 02, 02), NaiveTime::from_hms(12, 00, 01) @@ -73,11 +75,13 @@ mod tests { #[test] fn test_new_returns_ok_if_start_is_before_end() { + #[allow(clippy::zero_prefixed_literal)] let start = NaiveDateTime::new( NaiveDate::from_ymd(2000, 02, 02), NaiveTime::from_hms(12, 00, 01) ); + #[allow(clippy::zero_prefixed_literal)] let end = NaiveDateTime::new( NaiveDate::from_ymd(2000, 02, 02), NaiveTime::from_hms(12, 00, 02) diff --git a/lib/entry/libimagentrylink/src/linkable.rs b/lib/entry/libimagentrylink/src/linkable.rs index 4cb070f5..038c8036 100644 --- a/lib/entry/libimagentrylink/src/linkable.rs +++ b/lib/entry/libimagentrylink/src/linkable.rs @@ -383,6 +383,7 @@ mod test { } #[test] + #[clippy::cognitive_complexity = "49"] fn test_multiple_links() { setup_logging(); let store = get_store();