Skip to content

Commit

Permalink
Remove use of doc_cfg feature
Browse files Browse the repository at this point in the history
`doc_auto_cfg` is smart enough to correctly tag all cases now
  • Loading branch information
jhpratt committed Oct 3, 2022
1 parent 64c84b0 commit 44382c3
Show file tree
Hide file tree
Showing 12 changed files with 1 addition and 41 deletions.
3 changes: 0 additions & 3 deletions src/error/format.rs
Expand Up @@ -8,7 +8,6 @@ use crate::error;
/// An error occurred when formatting.
#[non_exhaustive]
#[allow(missing_copy_implementations)]
#[cfg_attr(__time_03_docs, doc(cfg(feature = "formatting")))]
#[derive(Debug)]
pub enum Format {
/// The type being formatted does not contain sufficient information to format a component.
Expand Down Expand Up @@ -65,14 +64,12 @@ impl std::error::Error for Format {
}
}

#[cfg_attr(__time_03_docs, doc(cfg(feature = "formatting")))]
impl From<Format> for crate::Error {
fn from(original: Format) -> Self {
Self::Format(original)
}
}

#[cfg_attr(__time_03_docs, doc(cfg(feature = "formatting")))]
impl TryFrom<crate::Error> for Format {
type Error = error::DifferentVariant;

Expand Down
3 changes: 0 additions & 3 deletions src/error/indeterminate_offset.rs
Expand Up @@ -5,7 +5,6 @@ use core::fmt;
use crate::error;

/// The system's UTC offset could not be determined at the given datetime.
#[cfg_attr(__time_03_docs, doc(cfg(feature = "local-offset")))]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct IndeterminateOffset;

Expand All @@ -18,14 +17,12 @@ impl fmt::Display for IndeterminateOffset {
#[cfg(feature = "std")]
impl std::error::Error for IndeterminateOffset {}

#[cfg_attr(__time_03_docs, doc(cfg(feature = "local-offset")))]
impl From<IndeterminateOffset> for crate::Error {
fn from(err: IndeterminateOffset) -> Self {
Self::IndeterminateOffset(err)
}
}

#[cfg_attr(__time_03_docs, doc(cfg(feature = "std")))]
impl TryFrom<crate::Error> for IndeterminateOffset {
type Error = error::DifferentVariant;

Expand Down
12 changes: 0 additions & 12 deletions src/error/invalid_format_description.rs
Expand Up @@ -6,10 +6,6 @@ use core::fmt;
use crate::error;

/// The format description provided was not valid.
#[cfg_attr(
__time_03_docs,
doc(cfg(all(any(feature = "formatting", feature = "parsing"), feature = "alloc")))
)]
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum InvalidFormatDescription {
Expand Down Expand Up @@ -43,20 +39,12 @@ pub enum InvalidFormatDescription {
},
}

#[cfg_attr(
__time_03_docs,
doc(cfg(all(any(feature = "formatting", feature = "parsing"), feature = "alloc")))
)]
impl From<InvalidFormatDescription> for crate::Error {
fn from(original: InvalidFormatDescription) -> Self {
Self::InvalidFormatDescription(original)
}
}

#[cfg_attr(
__time_03_docs,
doc(cfg(all(any(feature = "formatting", feature = "parsing"), feature = "alloc")))
)]
impl TryFrom<crate::Error> for InvalidFormatDescription {
type Error = error::DifferentVariant;

Expand Down
7 changes: 0 additions & 7 deletions src/error/parse.rs
Expand Up @@ -5,7 +5,6 @@ use core::fmt;
use crate::error::{self, ParseFromDescription, TryFromParsed};

/// An error that occurred at some stage of parsing.
#[cfg_attr(__time_03_docs, doc(cfg(feature = "parsing")))]
#[allow(variant_size_differences)]
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
Expand Down Expand Up @@ -40,14 +39,12 @@ impl std::error::Error for Parse {
}
}

#[cfg_attr(__time_03_docs, doc(cfg(feature = "parsing")))]
impl From<TryFromParsed> for Parse {
fn from(err: TryFromParsed) -> Self {
Self::TryFromParsed(err)
}
}

#[cfg_attr(__time_03_docs, doc(cfg(feature = "parsing")))]
impl TryFrom<Parse> for TryFromParsed {
type Error = error::DifferentVariant;

Expand All @@ -59,14 +56,12 @@ impl TryFrom<Parse> for TryFromParsed {
}
}

#[cfg_attr(__time_03_docs, doc(cfg(feature = "parsing")))]
impl From<ParseFromDescription> for Parse {
fn from(err: ParseFromDescription) -> Self {
Self::ParseFromDescription(err)
}
}

#[cfg_attr(__time_03_docs, doc(cfg(feature = "parsing")))]
impl TryFrom<Parse> for ParseFromDescription {
type Error = error::DifferentVariant;

Expand All @@ -78,7 +73,6 @@ impl TryFrom<Parse> for ParseFromDescription {
}
}

#[cfg_attr(__time_03_docs, doc(cfg(feature = "parsing")))]
impl From<Parse> for crate::Error {
fn from(err: Parse) -> Self {
match err {
Expand All @@ -89,7 +83,6 @@ impl From<Parse> for crate::Error {
}
}

#[cfg_attr(__time_03_docs, doc(cfg(feature = "parsing")))]
impl TryFrom<crate::Error> for Parse {
type Error = error::DifferentVariant;

Expand Down
3 changes: 0 additions & 3 deletions src/error/parse_from_description.rs
Expand Up @@ -5,7 +5,6 @@ use core::fmt;
use crate::error;

/// An error that occurred while parsing the input into a [`Parsed`](crate::parsing::Parsed) struct.
#[cfg_attr(__time_03_docs, doc(cfg(feature = "parsing")))]
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ParseFromDescription {
Expand All @@ -30,14 +29,12 @@ impl fmt::Display for ParseFromDescription {
#[cfg(feature = "std")]
impl std::error::Error for ParseFromDescription {}

#[cfg_attr(__time_03_docs, doc(cfg(feature = "parsing")))]
impl From<ParseFromDescription> for crate::Error {
fn from(original: ParseFromDescription) -> Self {
Self::ParseFromDescription(original)
}
}

#[cfg_attr(__time_03_docs, doc(cfg(feature = "parsing")))]
impl TryFrom<crate::Error> for ParseFromDescription {
type Error = error::DifferentVariant;

Expand Down
3 changes: 0 additions & 3 deletions src/error/try_from_parsed.rs
Expand Up @@ -6,7 +6,6 @@ use crate::error;

/// An error that occurred when converting a [`Parsed`](crate::parsing::Parsed) to another type.
#[non_exhaustive]
#[cfg_attr(__time_03_docs, doc(cfg(feature = "parsing")))]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum TryFromParsed {
/// The [`Parsed`](crate::parsing::Parsed) did not include enough information to construct the
Expand Down Expand Up @@ -54,14 +53,12 @@ impl std::error::Error for TryFromParsed {
}
}

#[cfg_attr(__time_03_docs, doc(cfg(feature = "parsing")))]
impl From<TryFromParsed> for crate::Error {
fn from(original: TryFromParsed) -> Self {
Self::TryFromParsed(original)
}
}

#[cfg_attr(__time_03_docs, doc(cfg(feature = "parsing")))]
impl TryFrom<crate::Error> for TryFromParsed {
type Error = error::DifferentVariant;

Expand Down
1 change: 0 additions & 1 deletion src/format_description/parse.rs
Expand Up @@ -80,7 +80,6 @@ fn parse_item<'a>(
///
/// The syntax for the format description can be found in [the
/// book](https://time-rs.github.io/book/api/format-description.html).
#[cfg_attr(__time_03_docs, doc(cfg(feature = "alloc")))]
pub fn parse(s: &str) -> Result<Vec<FormatItem<'_>>, InvalidFormatDescription> {
let mut compound = Vec::new();
let mut loc = 0;
Expand Down
1 change: 0 additions & 1 deletion src/formatting/formattable.rs
Expand Up @@ -27,7 +27,6 @@ mod sealed {
use super::*;

/// Format the item using a format description, the intended output, and the various components.
#[cfg_attr(__time_03_docs, doc(cfg(feature = "formatting")))]
pub trait Sealed {
/// Format the item into the provided output, returning the number of bytes written.
fn format_into(
Expand Down
1 change: 0 additions & 1 deletion src/instant.rs
Expand Up @@ -25,7 +25,6 @@ use crate::Duration;
///
/// This implementation allows for operations with signed [`Duration`]s, but is otherwise identical
/// to [`std::time::Instant`].
#[cfg_attr(__time_03_docs, doc(cfg(feature = "std")))]
#[repr(transparent)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Instant(pub StdInstant);
Expand Down
5 changes: 1 addition & 4 deletions src/lib.rs
Expand Up @@ -81,7 +81,7 @@
//! requires the local offset will return the `Err` variant when otherwise unsound.

#![doc(html_playground_url = "https://play.rust-lang.org")]
#![cfg_attr(__time_03_docs, feature(doc_cfg, doc_auto_cfg, doc_notable_trait))]
#![cfg_attr(__time_03_docs, feature(doc_auto_cfg, doc_notable_trait))]
#![cfg_attr(
__time_03_docs,
deny(rustdoc::broken_intra_doc_links, rustdoc::private_intra_doc_links)
Expand Down Expand Up @@ -315,13 +315,10 @@ mod offset_date_time;
pub mod parsing;
mod primitive_date_time;
#[cfg(feature = "quickcheck")]
#[cfg_attr(__time_03_docs, doc(cfg(feature = "quickcheck")))]
mod quickcheck;
#[cfg(feature = "rand")]
#[cfg_attr(__time_03_docs, doc(cfg(feature = "rand")))]
mod rand;
#[cfg(feature = "serde")]
#[cfg_attr(__time_03_docs, doc(cfg(feature = "serde")))]
#[allow(missing_copy_implementations, missing_debug_implementations)]
pub mod serde;
mod sys;
Expand Down
2 changes: 0 additions & 2 deletions src/offset_date_time.rs
Expand Up @@ -55,7 +55,6 @@ impl OffsetDateTime {
/// assert_eq!(OffsetDateTime::now_utc().offset(), offset!(UTC));
/// ```
#[cfg(feature = "std")]
#[cfg_attr(__time_03_docs, doc(cfg(feature = "std")))]
pub fn now_utc() -> Self {
#[cfg(all(
target_arch = "wasm32",
Expand Down Expand Up @@ -84,7 +83,6 @@ impl OffsetDateTime {
/// # }
/// ```
#[cfg(feature = "local-offset")]
#[cfg_attr(__time_03_docs, doc(cfg(feature = "local-offset")))]
pub fn now_local() -> Result<Self, error::IndeterminateOffset> {
let t = Self::now_utc();
Ok(t.to_offset(UtcOffset::local_offset_at(t)?))
Expand Down
1 change: 0 additions & 1 deletion src/parsing/parsable.rs
Expand Up @@ -27,7 +27,6 @@ mod sealed {
use super::*;

/// Parse the item using a format description and an input.
#[cfg_attr(__time_03_docs, doc(cfg(feature = "parsing")))]
pub trait Sealed {
/// Parse the item into the provided [`Parsed`] struct.
///
Expand Down

0 comments on commit 44382c3

Please sign in to comment.