Skip to content

Commit

Permalink
lint: remove ambiguous_negative_literal allow's in doc tests
Browse files Browse the repository at this point in the history
In favor of a global one. But also, while these aren't technically
needed any more[1,2], we leave them be for now while things settle.

[1]: rust-lang/rust#128449
[2]: rust-lang/rust#128287
  • Loading branch information
BurntSushi committed Aug 15, 2024
1 parent abae98e commit 5b11089
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 120 deletions.
24 changes: 0 additions & 24 deletions src/civil/date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1367,8 +1367,6 @@ impl Date {
/// # Example: negative spans are supported
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::{civil::Date, ToSpan};
///
/// let d = Date::constant(2024, 3, 31);
Expand All @@ -1382,8 +1380,6 @@ impl Date {
/// # Example: error on overflow
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::{civil::Date, ToSpan};
///
/// let d = Date::constant(2024, 3, 31);
Expand Down Expand Up @@ -1475,8 +1471,6 @@ impl Date {
/// # Example: negative spans are supported
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::{civil::Date, ToSpan};
///
/// let d = Date::constant(2024, 3, 31);
Expand All @@ -1490,8 +1484,6 @@ impl Date {
/// # Example: error on overflow
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::{civil::Date, ToSpan};
///
/// let d = Date::constant(2024, 3, 31);
Expand Down Expand Up @@ -1543,8 +1535,6 @@ impl Date {
/// # Example: negative spans are supported
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::{civil::Date, ToSpan};
///
/// let d = Date::constant(2024, 3, 31);
Expand All @@ -1557,8 +1547,6 @@ impl Date {
/// # Example: saturation on overflow
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::{civil::Date, ToSpan};
///
/// let d = Date::constant(2024, 3, 31);
Expand Down Expand Up @@ -1616,8 +1604,6 @@ impl Date {
/// # Example: negative spans are supported
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::{civil::Date, ToSpan};
///
/// let d = Date::constant(2024, 3, 31);
Expand All @@ -1630,8 +1616,6 @@ impl Date {
/// # Example: saturation on overflow
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::{civil::Date, ToSpan};
///
/// let d = Date::constant(2024, 3, 31);
Expand Down Expand Up @@ -1685,8 +1669,6 @@ impl Date {
/// # Examples
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::{civil::Date, ToSpan};
///
/// let earlier = Date::constant(2006, 8, 24);
Expand Down Expand Up @@ -1857,8 +1839,6 @@ impl Date {
/// # Examples
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::{civil::Date, ToSpan};
///
/// let earlier = Date::constant(2006, 8, 24);
Expand Down Expand Up @@ -2055,8 +2035,6 @@ impl Date {
/// When did the most recent Friday the 13th occur?
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::{civil::{Date, Weekday}, ToSpan};
///
/// let start = Date::constant(2024, 3, 13);
Expand Down Expand Up @@ -2711,8 +2689,6 @@ impl DateDifference {
/// This shows how to always round "up" towards positive infinity.
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::{civil::{Date, DateDifference}, RoundMode, ToSpan, Unit};
///
/// let d1 = "2024-01-15".parse::<Date>()?;
Expand Down
20 changes: 0 additions & 20 deletions src/civil/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1482,8 +1482,6 @@ impl DateTime {
/// # Example: negative spans are supported
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::{civil::date, ToSpan};
///
/// let dt = date(2024, 3, 31).at(19, 5, 59, 999_999_999);
Expand All @@ -1498,8 +1496,6 @@ impl DateTime {
/// # Example: error on overflow
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::{civil::date, ToSpan};
///
/// let dt = date(2024, 3, 31).at(13, 13, 13, 13);
Expand Down Expand Up @@ -1585,8 +1581,6 @@ impl DateTime {
/// # Example: negative spans are supported
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::{civil::date, ToSpan};
///
/// let dt = date(2024, 3, 31).at(19, 5, 59, 999_999_999);
Expand All @@ -1601,8 +1595,6 @@ impl DateTime {
/// # Example: error on overflow
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::{civil::date, ToSpan};
///
/// let dt = date(2024, 3, 31).at(13, 13, 13, 13);
Expand Down Expand Up @@ -1650,8 +1642,6 @@ impl DateTime {
/// # Example: negative spans are supported
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::{civil::date, ToSpan};
///
/// let dt = date(2024, 3, 31).at(19, 5, 59, 999_999_999);
Expand All @@ -1664,8 +1654,6 @@ impl DateTime {
/// # Example: saturation on overflow
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::{civil::{DateTime, date}, ToSpan};
///
/// let dt = date(2024, 3, 31).at(13, 13, 13, 13);
Expand Down Expand Up @@ -1720,8 +1708,6 @@ impl DateTime {
/// # Example: negative spans are supported
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::{civil::date, ToSpan};
///
/// let dt = date(2024, 3, 31).at(19, 5, 59, 999_999_999);
Expand All @@ -1734,8 +1720,6 @@ impl DateTime {
/// # Example: saturation on overflow
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::{civil::{DateTime, date}, ToSpan};
///
/// let dt = date(2024, 3, 31).at(13, 13, 13, 13);
Expand Down Expand Up @@ -1796,8 +1780,6 @@ impl DateTime {
/// # Example
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::{civil::date, ToSpan};
///
/// let earlier = date(2006, 8, 24).at(22, 30, 0, 0);
Expand Down Expand Up @@ -1968,8 +1950,6 @@ impl DateTime {
/// # Example
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::{civil::date, ToSpan};
///
/// let earlier = date(2006, 8, 24).at(22, 30, 0, 0);
Expand Down
6 changes: 0 additions & 6 deletions src/civil/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1180,8 +1180,6 @@ impl Time {
/// # Examples
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::{civil::Time, ToSpan};
///
/// let t1 = Time::constant(22, 35, 1, 0);
Expand Down Expand Up @@ -1269,8 +1267,6 @@ impl Time {
/// # Examples
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::{civil::Time, ToSpan};
///
/// let t1 = Time::constant(22, 35, 1, 0);
Expand Down Expand Up @@ -1472,8 +1468,6 @@ impl Time {
/// Or go backwards every 6.5 hours:
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::{civil::Time, ToSpan};
///
/// let start = Time::constant(23, 0, 0, 0);
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,8 @@ specifiers and other APIs.
#![deny(missing_docs)]
// See: https://github.com/rust-lang/rust/pull/121364
#![allow(unknown_lints, ambiguous_negative_literals)]
// See: https://github.com/rust-lang/rust/pull/121364
#![doc(test(attr(allow(unknown_lints, ambiguous_negative_literals))))]

// It should be possible to support other pointer widths, but this library
// hasn't been tested nor thought about much in contexts with pointers less
Expand Down
26 changes: 0 additions & 26 deletions src/span.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ use crate::{
/// A span may be negative. All of these are equivalent:
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::{Span, ToSpan};
///
/// let span = -Span::new().days(5);
Expand Down Expand Up @@ -125,8 +123,6 @@ use crate::{
/// then all of its units are negative:
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::ToSpan;
///
/// let span = -5.days().hours(10).minutes(1);
Expand All @@ -139,8 +135,6 @@ use crate::{
/// as negative:
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::ToSpan;
///
/// // It's the same thing.
Expand Down Expand Up @@ -552,8 +546,6 @@ use crate::{
/// span positive before converting it to a `Duration`:
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use std::time::Duration;
///
/// use jiff::{Span, ToSpan};
Expand Down Expand Up @@ -1165,8 +1157,6 @@ impl Span {
/// # Example
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::ToSpan;
///
/// let span = -100.seconds();
Expand Down Expand Up @@ -1232,8 +1222,6 @@ impl Span {
/// # Example
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::ToSpan;
///
/// assert!(!2.months().is_negative());
Expand All @@ -1251,8 +1239,6 @@ impl Span {
/// # Example
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::ToSpan;
///
/// assert!(!2.months().is_negative());
Expand Down Expand Up @@ -1289,8 +1275,6 @@ impl Span {
/// # Example
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::ToSpan;
///
/// let span = 4.days().seconds(8);
Expand All @@ -1312,8 +1296,6 @@ impl Span {
/// happens on overflow.
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::ToSpan;
///
/// let span = 4.days().seconds(8);
Expand Down Expand Up @@ -1678,8 +1660,6 @@ impl Span {
/// # Example: negative spans are less than zero
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::ToSpan;
///
/// let span1 = -1.second();
Expand Down Expand Up @@ -2080,8 +2060,6 @@ impl Span {
/// the span positive before converting it to a `Duration`:
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use std::time::Duration;
///
/// use jiff::{civil::date, Span, ToSpan};
Expand Down Expand Up @@ -2984,8 +2962,6 @@ impl core::ops::Mul<Span> for i64 {
/// span positive before converting it to a `Duration`:
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use std::time::Duration;
///
/// use jiff::{Span, ToSpan};
Expand Down Expand Up @@ -3235,8 +3211,6 @@ impl quickcheck::Arbitrary for Span {
/// # Example
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
/// use jiff::ToSpan;
///
/// assert_eq!(5.days().to_string(), "P5d");
Expand Down
Loading

0 comments on commit 5b11089

Please sign in to comment.