From f93c8a993d247ad60c2bc1a52a36df5890037830 Mon Sep 17 00:00:00 2001 From: David Kellum Date: Fri, 12 Jan 2018 15:11:47 -0800 Subject: [PATCH 1/3] Add top level clippy allow const_static_lifetime github: cc: #205 --- src/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index c20ff58..1cd9fb3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -387,6 +387,12 @@ #![deny(missing_docs)] #![deny(missing_debug_implementations)] +// The explicit 'static lifetimes are still needed for rustc 1.13-16 +// backward compatibility, and this appeases clippy. If minimum rustc +// becomes 1.17, should be able to remove this, those 'static lifetimes, +// and use `static` in a lot of places `const` is used now. +#![allow(const_static_lifetime)] + extern crate time as oldtime; extern crate num; #[cfg(feature = "rustc-serialize")] From 4748225550acc92179e18490c299cc94ccc2bf51 Mon Sep 17 00:00:00 2001 From: David Kellum Date: Fri, 12 Jan 2018 16:17:53 -0800 Subject: [PATCH 2/3] allow(const_static_lifetime) is for feature cargo-clippy --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 1cd9fb3..4e37d30 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -391,7 +391,7 @@ // backward compatibility, and this appeases clippy. If minimum rustc // becomes 1.17, should be able to remove this, those 'static lifetimes, // and use `static` in a lot of places `const` is used now. -#![allow(const_static_lifetime)] +#![cfg_attr(feature = "cargo-clippy", allow(const_static_lifetime))] extern crate time as oldtime; extern crate num; From 9742ecccc5f2230512be1f539bf7838f2769521b Mon Sep 17 00:00:00 2001 From: David Kellum Date: Wed, 17 Jan 2018 11:41:33 -0800 Subject: [PATCH 3/3] Allow (clippy) needless_pass_by_value on signed_duration_since Current clippy is probably correct, but its a breaking change that isn't appropriate now. Add allow's to get the build working again. Also these Date(Time)::signed_duration_since cases appear to match there `Naive` counterparts, where clippy isn't complaining. If its fixed in the future, should probably be changed across the board, not just here. --- src/date.rs | 1 + src/datetime.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/date.rs b/src/date.rs index 7acdde7..dba7dd0 100644 --- a/src/date.rs +++ b/src/date.rs @@ -224,6 +224,7 @@ impl Date { /// /// This does not overflow or underflow at all, /// as all possible output fits in the range of `Duration`. + #[cfg_attr(feature = "cargo-clippy", allow(needless_pass_by_value))] #[inline] pub fn signed_duration_since(self, rhs: Date) -> OldDuration { self.date.signed_duration_since(rhs.date) diff --git a/src/datetime.rs b/src/datetime.rs index f5ca30c..6500ee7 100644 --- a/src/datetime.rs +++ b/src/datetime.rs @@ -159,6 +159,7 @@ impl DateTime { /// Subtracts another `DateTime` from the current date and time. /// This does not overflow or underflow at all. + #[cfg_attr(feature = "cargo-clippy", allow(needless_pass_by_value))] #[inline] pub fn signed_duration_since(self, rhs: DateTime) -> OldDuration { self.datetime.signed_duration_since(rhs.datetime)