From 6248992b918638bc4f9e06e326c1fdace9c56fee Mon Sep 17 00:00:00 2001 From: Jacob Pratt Date: Mon, 18 Sep 2023 23:33:10 -0400 Subject: [PATCH] Address lints --- time-macros/src/lib.rs | 1 + time-macros/src/quote.rs | 1 + time/src/error/mod.rs | 1 + time/src/format_description/well_known/iso8601/adt_hack.rs | 7 +++---- time/src/quickcheck.rs | 2 +- time/src/utc_offset.rs | 6 ------ 6 files changed, 7 insertions(+), 11 deletions(-) diff --git a/time-macros/src/lib.rs b/time-macros/src/lib.rs index 5cb72a647..d9e46931b 100644 --- a/time-macros/src/lib.rs +++ b/time-macros/src/lib.rs @@ -68,6 +68,7 @@ enum FormatDescriptionVersion { #[cfg(any(feature = "formatting", feature = "parsing"))] enum VersionOrModuleName { Version(FormatDescriptionVersion), + #[cfg_attr(not(feature = "serde"), allow(unused_tuple_struct_fields))] ModuleName(Ident), } diff --git a/time-macros/src/quote.rs b/time-macros/src/quote.rs index 2c96807f9..8603f4fa4 100644 --- a/time-macros/src/quote.rs +++ b/time-macros/src/quote.rs @@ -45,6 +45,7 @@ macro_rules! sym { }; } +#[allow(unused_macro_rules)] // Varies by feature flag combination. macro_rules! quote_inner { // Base case ($ts:ident) => {}; diff --git a/time/src/error/mod.rs b/time/src/error/mod.rs index 633909306..d2730c462 100644 --- a/time/src/error/mod.rs +++ b/time/src/error/mod.rs @@ -36,6 +36,7 @@ pub use parse_from_description::ParseFromDescription; #[cfg(feature = "parsing")] pub use try_from_parsed::TryFromParsed; +#[cfg(feature = "parsing")] use crate::internal_macros::bug; /// A unified error type for anything returned by a method in the time crate. diff --git a/time/src/format_description/well_known/iso8601/adt_hack.rs b/time/src/format_description/well_known/iso8601/adt_hack.rs index 1fdecaf26..12b1c725f 100644 --- a/time/src/format_description/well_known/iso8601/adt_hack.rs +++ b/time/src/format_description/well_known/iso8601/adt_hack.rs @@ -49,11 +49,10 @@ impl Iso8601 { } impl Config { - /// Encode the configuration, permitting it to be used as a const parameter of - /// [`Iso8601`](super::Iso8601). + /// Encode the configuration, permitting it to be used as a const parameter of [`Iso8601`]. /// - /// The value returned by this method must only be used as a const parameter to - /// [`Iso8601`](super::Iso8601). Any other usage is unspecified behavior. + /// The value returned by this method must only be used as a const parameter to [`Iso8601`]. Any + /// other usage is unspecified behavior. pub const fn encode(&self) -> EncodedConfig { let mut bytes = [0; EncodedConfig::BITS as usize / 8]; diff --git a/time/src/quickcheck.rs b/time/src/quickcheck.rs index 791491e44..02cc62282 100644 --- a/time/src/quickcheck.rs +++ b/time/src/quickcheck.rs @@ -2,7 +2,7 @@ //! //! This enables users to write tests such as this, and have test values provided automatically: //! -//! ``` +//! ```ignore //! # #![allow(dead_code)] //! use quickcheck::quickcheck; //! use time::Date; diff --git a/time/src/utc_offset.rs b/time/src/utc_offset.rs index 01c948536..8e4f39375 100644 --- a/time/src/utc_offset.rs +++ b/time/src/utc_offset.rs @@ -207,12 +207,6 @@ impl UtcOffset { /// Obtain the UTC offset as its hours, minutes, and seconds. The sign of all three components /// will always match. A positive value indicates an offset to the east; a negative to the west. - /// - /// ```rust - /// # use time_macros::offset; - /// assert_eq!(offset!(+1:02:03).as_hms(), (1, 2, 3)); - /// assert_eq!(offset!(-1:02:03).as_hms(), (-1, -2, -3)); - /// ``` #[cfg(feature = "quickcheck")] pub(crate) const fn as_hms_ranged(self) -> (Hours, Minutes, Seconds) { (self.hours, self.minutes, self.seconds)