Skip to content

Commit 5b11089

Browse files
committed
lint: remove ambiguous_negative_literal allow's in doc tests
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
1 parent abae98e commit 5b11089

File tree

8 files changed

+2
-120
lines changed

8 files changed

+2
-120
lines changed

src/civil/date.rs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,8 +1367,6 @@ impl Date {
13671367
/// # Example: negative spans are supported
13681368
///
13691369
/// ```
1370-
/// # // See: https://github.com/rust-lang/rust/pull/121364
1371-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
13721370
/// use jiff::{civil::Date, ToSpan};
13731371
///
13741372
/// let d = Date::constant(2024, 3, 31);
@@ -1382,8 +1380,6 @@ impl Date {
13821380
/// # Example: error on overflow
13831381
///
13841382
/// ```
1385-
/// # // See: https://github.com/rust-lang/rust/pull/121364
1386-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
13871383
/// use jiff::{civil::Date, ToSpan};
13881384
///
13891385
/// let d = Date::constant(2024, 3, 31);
@@ -1475,8 +1471,6 @@ impl Date {
14751471
/// # Example: negative spans are supported
14761472
///
14771473
/// ```
1478-
/// # // See: https://github.com/rust-lang/rust/pull/121364
1479-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
14801474
/// use jiff::{civil::Date, ToSpan};
14811475
///
14821476
/// let d = Date::constant(2024, 3, 31);
@@ -1490,8 +1484,6 @@ impl Date {
14901484
/// # Example: error on overflow
14911485
///
14921486
/// ```
1493-
/// # // See: https://github.com/rust-lang/rust/pull/121364
1494-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
14951487
/// use jiff::{civil::Date, ToSpan};
14961488
///
14971489
/// let d = Date::constant(2024, 3, 31);
@@ -1543,8 +1535,6 @@ impl Date {
15431535
/// # Example: negative spans are supported
15441536
///
15451537
/// ```
1546-
/// # // See: https://github.com/rust-lang/rust/pull/121364
1547-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
15481538
/// use jiff::{civil::Date, ToSpan};
15491539
///
15501540
/// let d = Date::constant(2024, 3, 31);
@@ -1557,8 +1547,6 @@ impl Date {
15571547
/// # Example: saturation on overflow
15581548
///
15591549
/// ```
1560-
/// # // See: https://github.com/rust-lang/rust/pull/121364
1561-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
15621550
/// use jiff::{civil::Date, ToSpan};
15631551
///
15641552
/// let d = Date::constant(2024, 3, 31);
@@ -1616,8 +1604,6 @@ impl Date {
16161604
/// # Example: negative spans are supported
16171605
///
16181606
/// ```
1619-
/// # // See: https://github.com/rust-lang/rust/pull/121364
1620-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
16211607
/// use jiff::{civil::Date, ToSpan};
16221608
///
16231609
/// let d = Date::constant(2024, 3, 31);
@@ -1630,8 +1616,6 @@ impl Date {
16301616
/// # Example: saturation on overflow
16311617
///
16321618
/// ```
1633-
/// # // See: https://github.com/rust-lang/rust/pull/121364
1634-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
16351619
/// use jiff::{civil::Date, ToSpan};
16361620
///
16371621
/// let d = Date::constant(2024, 3, 31);
@@ -1685,8 +1669,6 @@ impl Date {
16851669
/// # Examples
16861670
///
16871671
/// ```
1688-
/// # // See: https://github.com/rust-lang/rust/pull/121364
1689-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
16901672
/// use jiff::{civil::Date, ToSpan};
16911673
///
16921674
/// let earlier = Date::constant(2006, 8, 24);
@@ -1857,8 +1839,6 @@ impl Date {
18571839
/// # Examples
18581840
///
18591841
/// ```
1860-
/// # // See: https://github.com/rust-lang/rust/pull/121364
1861-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
18621842
/// use jiff::{civil::Date, ToSpan};
18631843
///
18641844
/// let earlier = Date::constant(2006, 8, 24);
@@ -2055,8 +2035,6 @@ impl Date {
20552035
/// When did the most recent Friday the 13th occur?
20562036
///
20572037
/// ```
2058-
/// # // See: https://github.com/rust-lang/rust/pull/121364
2059-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
20602038
/// use jiff::{civil::{Date, Weekday}, ToSpan};
20612039
///
20622040
/// let start = Date::constant(2024, 3, 13);
@@ -2711,8 +2689,6 @@ impl DateDifference {
27112689
/// This shows how to always round "up" towards positive infinity.
27122690
///
27132691
/// ```
2714-
/// # // See: https://github.com/rust-lang/rust/pull/121364
2715-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
27162692
/// use jiff::{civil::{Date, DateDifference}, RoundMode, ToSpan, Unit};
27172693
///
27182694
/// let d1 = "2024-01-15".parse::<Date>()?;

src/civil/datetime.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,8 +1482,6 @@ impl DateTime {
14821482
/// # Example: negative spans are supported
14831483
///
14841484
/// ```
1485-
/// # // See: https://github.com/rust-lang/rust/pull/121364
1486-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
14871485
/// use jiff::{civil::date, ToSpan};
14881486
///
14891487
/// let dt = date(2024, 3, 31).at(19, 5, 59, 999_999_999);
@@ -1498,8 +1496,6 @@ impl DateTime {
14981496
/// # Example: error on overflow
14991497
///
15001498
/// ```
1501-
/// # // See: https://github.com/rust-lang/rust/pull/121364
1502-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
15031499
/// use jiff::{civil::date, ToSpan};
15041500
///
15051501
/// let dt = date(2024, 3, 31).at(13, 13, 13, 13);
@@ -1585,8 +1581,6 @@ impl DateTime {
15851581
/// # Example: negative spans are supported
15861582
///
15871583
/// ```
1588-
/// # // See: https://github.com/rust-lang/rust/pull/121364
1589-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
15901584
/// use jiff::{civil::date, ToSpan};
15911585
///
15921586
/// let dt = date(2024, 3, 31).at(19, 5, 59, 999_999_999);
@@ -1601,8 +1595,6 @@ impl DateTime {
16011595
/// # Example: error on overflow
16021596
///
16031597
/// ```
1604-
/// # // See: https://github.com/rust-lang/rust/pull/121364
1605-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
16061598
/// use jiff::{civil::date, ToSpan};
16071599
///
16081600
/// let dt = date(2024, 3, 31).at(13, 13, 13, 13);
@@ -1650,8 +1642,6 @@ impl DateTime {
16501642
/// # Example: negative spans are supported
16511643
///
16521644
/// ```
1653-
/// # // See: https://github.com/rust-lang/rust/pull/121364
1654-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
16551645
/// use jiff::{civil::date, ToSpan};
16561646
///
16571647
/// let dt = date(2024, 3, 31).at(19, 5, 59, 999_999_999);
@@ -1664,8 +1654,6 @@ impl DateTime {
16641654
/// # Example: saturation on overflow
16651655
///
16661656
/// ```
1667-
/// # // See: https://github.com/rust-lang/rust/pull/121364
1668-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
16691657
/// use jiff::{civil::{DateTime, date}, ToSpan};
16701658
///
16711659
/// let dt = date(2024, 3, 31).at(13, 13, 13, 13);
@@ -1720,8 +1708,6 @@ impl DateTime {
17201708
/// # Example: negative spans are supported
17211709
///
17221710
/// ```
1723-
/// # // See: https://github.com/rust-lang/rust/pull/121364
1724-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
17251711
/// use jiff::{civil::date, ToSpan};
17261712
///
17271713
/// let dt = date(2024, 3, 31).at(19, 5, 59, 999_999_999);
@@ -1734,8 +1720,6 @@ impl DateTime {
17341720
/// # Example: saturation on overflow
17351721
///
17361722
/// ```
1737-
/// # // See: https://github.com/rust-lang/rust/pull/121364
1738-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
17391723
/// use jiff::{civil::{DateTime, date}, ToSpan};
17401724
///
17411725
/// let dt = date(2024, 3, 31).at(13, 13, 13, 13);
@@ -1796,8 +1780,6 @@ impl DateTime {
17961780
/// # Example
17971781
///
17981782
/// ```
1799-
/// # // See: https://github.com/rust-lang/rust/pull/121364
1800-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
18011783
/// use jiff::{civil::date, ToSpan};
18021784
///
18031785
/// let earlier = date(2006, 8, 24).at(22, 30, 0, 0);
@@ -1968,8 +1950,6 @@ impl DateTime {
19681950
/// # Example
19691951
///
19701952
/// ```
1971-
/// # // See: https://github.com/rust-lang/rust/pull/121364
1972-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
19731953
/// use jiff::{civil::date, ToSpan};
19741954
///
19751955
/// let earlier = date(2006, 8, 24).at(22, 30, 0, 0);

src/civil/time.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,8 +1180,6 @@ impl Time {
11801180
/// # Examples
11811181
///
11821182
/// ```
1183-
/// # // See: https://github.com/rust-lang/rust/pull/121364
1184-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
11851183
/// use jiff::{civil::Time, ToSpan};
11861184
///
11871185
/// let t1 = Time::constant(22, 35, 1, 0);
@@ -1269,8 +1267,6 @@ impl Time {
12691267
/// # Examples
12701268
///
12711269
/// ```
1272-
/// # // See: https://github.com/rust-lang/rust/pull/121364
1273-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
12741270
/// use jiff::{civil::Time, ToSpan};
12751271
///
12761272
/// let t1 = Time::constant(22, 35, 1, 0);
@@ -1472,8 +1468,6 @@ impl Time {
14721468
/// Or go backwards every 6.5 hours:
14731469
///
14741470
/// ```
1475-
/// # // See: https://github.com/rust-lang/rust/pull/121364
1476-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
14771471
/// use jiff::{civil::Time, ToSpan};
14781472
///
14791473
/// let start = Time::constant(23, 0, 0, 0);

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,8 @@ specifiers and other APIs.
606606
#![deny(missing_docs)]
607607
// See: https://github.com/rust-lang/rust/pull/121364
608608
#![allow(unknown_lints, ambiguous_negative_literals)]
609+
// See: https://github.com/rust-lang/rust/pull/121364
610+
#![doc(test(attr(allow(unknown_lints, ambiguous_negative_literals))))]
609611

610612
// It should be possible to support other pointer widths, but this library
611613
// hasn't been tested nor thought about much in contexts with pointers less

src/span.rs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ use crate::{
9595
/// A span may be negative. All of these are equivalent:
9696
///
9797
/// ```
98-
/// # // See: https://github.com/rust-lang/rust/pull/121364
99-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
10098
/// use jiff::{Span, ToSpan};
10199
///
102100
/// let span = -Span::new().days(5);
@@ -125,8 +123,6 @@ use crate::{
125123
/// then all of its units are negative:
126124
///
127125
/// ```
128-
/// # // See: https://github.com/rust-lang/rust/pull/121364
129-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
130126
/// use jiff::ToSpan;
131127
///
132128
/// let span = -5.days().hours(10).minutes(1);
@@ -139,8 +135,6 @@ use crate::{
139135
/// as negative:
140136
///
141137
/// ```
142-
/// # // See: https://github.com/rust-lang/rust/pull/121364
143-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
144138
/// use jiff::ToSpan;
145139
///
146140
/// // It's the same thing.
@@ -552,8 +546,6 @@ use crate::{
552546
/// span positive before converting it to a `Duration`:
553547
///
554548
/// ```
555-
/// # // See: https://github.com/rust-lang/rust/pull/121364
556-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
557549
/// use std::time::Duration;
558550
///
559551
/// use jiff::{Span, ToSpan};
@@ -1165,8 +1157,6 @@ impl Span {
11651157
/// # Example
11661158
///
11671159
/// ```
1168-
/// # // See: https://github.com/rust-lang/rust/pull/121364
1169-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
11701160
/// use jiff::ToSpan;
11711161
///
11721162
/// let span = -100.seconds();
@@ -1232,8 +1222,6 @@ impl Span {
12321222
/// # Example
12331223
///
12341224
/// ```
1235-
/// # // See: https://github.com/rust-lang/rust/pull/121364
1236-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
12371225
/// use jiff::ToSpan;
12381226
///
12391227
/// assert!(!2.months().is_negative());
@@ -1251,8 +1239,6 @@ impl Span {
12511239
/// # Example
12521240
///
12531241
/// ```
1254-
/// # // See: https://github.com/rust-lang/rust/pull/121364
1255-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
12561242
/// use jiff::ToSpan;
12571243
///
12581244
/// assert!(!2.months().is_negative());
@@ -1289,8 +1275,6 @@ impl Span {
12891275
/// # Example
12901276
///
12911277
/// ```
1292-
/// # // See: https://github.com/rust-lang/rust/pull/121364
1293-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
12941278
/// use jiff::ToSpan;
12951279
///
12961280
/// let span = 4.days().seconds(8);
@@ -1312,8 +1296,6 @@ impl Span {
13121296
/// happens on overflow.
13131297
///
13141298
/// ```
1315-
/// # // See: https://github.com/rust-lang/rust/pull/121364
1316-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
13171299
/// use jiff::ToSpan;
13181300
///
13191301
/// let span = 4.days().seconds(8);
@@ -1678,8 +1660,6 @@ impl Span {
16781660
/// # Example: negative spans are less than zero
16791661
///
16801662
/// ```
1681-
/// # // See: https://github.com/rust-lang/rust/pull/121364
1682-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
16831663
/// use jiff::ToSpan;
16841664
///
16851665
/// let span1 = -1.second();
@@ -2080,8 +2060,6 @@ impl Span {
20802060
/// the span positive before converting it to a `Duration`:
20812061
///
20822062
/// ```
2083-
/// # // See: https://github.com/rust-lang/rust/pull/121364
2084-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
20852063
/// use std::time::Duration;
20862064
///
20872065
/// use jiff::{civil::date, Span, ToSpan};
@@ -2984,8 +2962,6 @@ impl core::ops::Mul<Span> for i64 {
29842962
/// span positive before converting it to a `Duration`:
29852963
///
29862964
/// ```
2987-
/// # // See: https://github.com/rust-lang/rust/pull/121364
2988-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
29892965
/// use std::time::Duration;
29902966
///
29912967
/// use jiff::{Span, ToSpan};
@@ -3235,8 +3211,6 @@ impl quickcheck::Arbitrary for Span {
32353211
/// # Example
32363212
///
32373213
/// ```
3238-
/// # // See: https://github.com/rust-lang/rust/pull/121364
3239-
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
32403214
/// use jiff::ToSpan;
32413215
///
32423216
/// assert_eq!(5.days().to_string(), "P5d");

0 commit comments

Comments
 (0)