Skip to content

Commit c45cae5

Browse files
authored
Revert "More clippy" (#7461)
Reverts #7459 before it bitrots so we can discuss this.
1 parent 5a8a1d5 commit c45cae5

File tree

232 files changed

+2326
-2160
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

232 files changed

+2326
-2160
lines changed

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,7 @@ clippy.negative_feature_names = "warn"
355355
clippy.same_functions_in_if_condition = "warn"
356356
clippy.todo = "warn"
357357
clippy.trivially_copy_pass_by_ref = "deny"
358-
clippy.use_self = "warn"
359358
clippy.wildcard_dependencies = "warn"
360-
clippy.redundant_type_annotations = "warn"
361359
rust.missing_debug_implementations = "deny"
362360
rust.trivial_numeric_casts = "deny"
363361
rust.unexpected_cfgs = { level = "warn", check-cfg = [
@@ -385,6 +383,7 @@ rust.unused_macro_rules = "warn"
385383
# clippy.default_trait_access = "warn"
386384
# clippy.missing_assert_message = "warn"
387385
# clippy.redundant_feature_names = "warn"
386+
# clippy.use_self = "warn"
388387
# rust.unreachable_pub = "warn"
389388
# rust.unused_qualifications = "warn"
390389
# rust.unsafe_op_in_unsafe_fn = "forbid"

components/calendar/src/any_calendar.rs

Lines changed: 143 additions & 113 deletions
Large diffs are not rendered by default.

components/calendar/src/cal/buddhist.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,11 @@ impl Date<Buddhist> {
9090
/// assert_eq!(date_buddhist.month().ordinal, 1);
9191
/// assert_eq!(date_buddhist.day_of_month().0, 2);
9292
/// ```
93-
pub fn try_new_buddhist(year: i32, month: u8, day: u8) -> Result<Self, RangeError> {
93+
pub fn try_new_buddhist(year: i32, month: u8, day: u8) -> Result<Date<Buddhist>, RangeError> {
9494
ArithmeticDate::from_year_month_day(year, month, day, &AbstractGregorian(BuddhistEra))
9595
.map(ArithmeticDate::cast)
9696
.map(BuddhistDateInner)
97-
.map(|i| Self::from_raw(i, Buddhist))
97+
.map(|i| Date::from_raw(i, Buddhist))
9898
}
9999
}
100100

components/calendar/src/cal/coptic.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ impl DateFieldsResolver for Coptic {
8888
month: types::Month,
8989
day: u8,
9090
) -> Result<Self::YearInfo, EcmaReferenceYearError> {
91-
Self::reference_year_from_month_day(month, day)
91+
Coptic::reference_year_from_month_day(month, day)
9292
}
9393

9494
fn to_rata_die_inner(year: Self::YearInfo, month: u8, day: u8) -> RataDie {
@@ -250,10 +250,10 @@ impl Date<Coptic> {
250250
/// assert_eq!(date_coptic.month().ordinal, 5);
251251
/// assert_eq!(date_coptic.day_of_month().0, 6);
252252
/// ```
253-
pub fn try_new_coptic(year: i32, month: u8, day: u8) -> Result<Self, RangeError> {
253+
pub fn try_new_coptic(year: i32, month: u8, day: u8) -> Result<Date<Coptic>, RangeError> {
254254
ArithmeticDate::from_year_month_day(year, month, day, &Coptic)
255255
.map(CopticDateInner)
256-
.map(|inner| Self::from_raw(inner, Coptic))
256+
.map(|inner| Date::from_raw(inner, Coptic))
257257
}
258258
}
259259

components/calendar/src/cal/east_asian_traditional.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -484,15 +484,15 @@ impl<A: AsCalendar<Calendar = KoreanTraditional>> Date<A> {
484484
ordinal_month: u8,
485485
day: u8,
486486
calendar: A,
487-
) -> Result<Self, DateError> {
487+
) -> Result<Date<A>, DateError> {
488488
ArithmeticDate::from_year_month_day(
489489
related_iso_year,
490490
ordinal_month,
491491
day,
492492
calendar.as_calendar(),
493493
)
494494
.map(ChineseDateInner)
495-
.map(|inner| Self::from_raw(inner, calendar))
495+
.map(|inner| Date::from_raw(inner, calendar))
496496
.map_err(Into::into)
497497
}
498498
}
@@ -522,7 +522,7 @@ impl<R: Rules> Ord for ChineseDateInner<R> {
522522
impl ChineseTraditional {
523523
/// Creates a new [`ChineseTraditional`] calendar.
524524
pub const fn new() -> Self {
525-
Self(China)
525+
EastAsianTraditional(China)
526526
}
527527

528528
#[cfg(feature = "serde")]
@@ -801,15 +801,15 @@ impl<A: AsCalendar<Calendar = ChineseTraditional>> Date<A> {
801801
ordinal_month: u8,
802802
day: u8,
803803
calendar: A,
804-
) -> Result<Self, DateError> {
804+
) -> Result<Date<A>, DateError> {
805805
ArithmeticDate::from_year_month_day(
806806
related_iso_year,
807807
ordinal_month,
808808
day,
809809
calendar.as_calendar(),
810810
)
811811
.map(ChineseDateInner)
812-
.map(|inner| Self::from_raw(inner, calendar))
812+
.map(|inner| Date::from_raw(inner, calendar))
813813
.map_err(Into::into)
814814
}
815815
}
@@ -888,7 +888,9 @@ impl EastAsianTraditionalYear {
888888
})
889889
}
890890

891-
fn calendrical_calculations<CB: chinese_based::ChineseBased>(related_iso: i32) -> Self {
891+
fn calendrical_calculations<CB: chinese_based::ChineseBased>(
892+
related_iso: i32,
893+
) -> EastAsianTraditionalYear {
892894
let mid_year = calendrical_calculations::gregorian::fixed_from_gregorian(related_iso, 7, 1);
893895
let year_bounds = chinese_based::YearBounds::compute::<CB>(mid_year);
894896

@@ -900,7 +902,7 @@ impl EastAsianTraditionalYear {
900902
let (month_lengths, leap_month) =
901903
chinese_based::month_structure_for_year::<CB>(new_year, next_new_year);
902904

903-
Self {
905+
EastAsianTraditionalYear {
904906
packed: PackedEastAsianTraditionalYearData::new(
905907
related_iso,
906908
month_lengths,

components/calendar/src/cal/east_asian_traditional/simple.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ impl core::ops::Add<Milliseconds> for LocalMoment {
7272
}
7373
}
7474

75-
impl EastAsianTraditionalYear {
75+
impl super::EastAsianTraditionalYear {
7676
/// A fast approximation for the Chinese calendar, inspired by the _píngqì_ (平氣) rule
7777
/// used in the Ming dynasty.
7878
///
7979
/// Stays anchored in the Gregorian calendar, even as the Gregorian calendar drifts
8080
/// from the seasons in the distant future and distant past.
81-
pub(super) fn simple(utc_offset: Milliseconds, related_iso: i32) -> Self {
81+
pub(super) fn simple(utc_offset: Milliseconds, related_iso: i32) -> EastAsianTraditionalYear {
8282
/// calculates the largest moment such that `moment = base_moment + n * duration` lands on `rata_die` (< `rata_die + 1`)
8383
fn periodic_duration_on_or_before(
8484
rata_die: RataDie,
@@ -166,7 +166,7 @@ impl EastAsianTraditionalYear {
166166

167167
debug_assert_eq!(solar_term, 12);
168168

169-
Self {
169+
EastAsianTraditionalYear {
170170
packed: PackedEastAsianTraditionalYearData::new(
171171
related_iso,
172172
month_lengths,

components/calendar/src/cal/ethiopian.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,12 @@ impl Date<Ethiopian> {
303303
year: i32,
304304
month: u8,
305305
day: u8,
306-
) -> Result<Self, RangeError> {
306+
) -> Result<Date<Ethiopian>, RangeError> {
307307
ArithmeticDate::from_year_month_day(year, month, day, &Ethiopian(era_style))
308308
.map(ArithmeticDate::cast)
309309
.map(CopticDateInner)
310310
.map(EthiopianDateInner)
311-
.map(|inner| Self::from_raw(inner, Ethiopian(era_style)))
311+
.map(|inner| Date::from_raw(inner, Ethiopian(era_style)))
312312
}
313313
}
314314

components/calendar/src/cal/gregorian.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,11 @@ impl Date<Gregorian> {
136136
/// assert_eq!(date_gregorian.month().ordinal, 1);
137137
/// assert_eq!(date_gregorian.day_of_month().0, 2);
138138
/// ```
139-
pub fn try_new_gregorian(year: i32, month: u8, day: u8) -> Result<Self, RangeError> {
139+
pub fn try_new_gregorian(year: i32, month: u8, day: u8) -> Result<Date<Gregorian>, RangeError> {
140140
ArithmeticDate::from_year_month_day(year, month, day, &AbstractGregorian(CeBce))
141141
.map(ArithmeticDate::cast)
142142
.map(GregorianDateInner)
143-
.map(|i| Self::from_raw(i, Gregorian))
143+
.map(|i| Date::from_raw(i, Gregorian))
144144
}
145145
}
146146

components/calendar/src/cal/hebrew.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub struct HebrewDateInner(ArithmeticDate<Hebrew>);
5959
impl Hebrew {
6060
/// Construct a new [`Hebrew`]
6161
pub fn new() -> Self {
62-
Self
62+
Hebrew
6363
}
6464
}
6565

@@ -354,10 +354,14 @@ impl Date<Hebrew> {
354354
///
355355
/// Use [`Date::try_new_from_codes`]
356356
#[deprecated(since = "2.1.0", note = "use `Date::try_new_from_codes`")]
357-
pub fn try_new_hebrew(year: i32, ordinal_month: u8, day: u8) -> Result<Self, RangeError> {
357+
pub fn try_new_hebrew(
358+
year: i32,
359+
ordinal_month: u8,
360+
day: u8,
361+
) -> Result<Date<Hebrew>, RangeError> {
358362
ArithmeticDate::from_year_month_day(year, ordinal_month, day, &Hebrew)
359363
.map(HebrewDateInner)
360-
.map(|inner| Self::from_raw(inner, Hebrew))
364+
.map(|inner| Date::from_raw(inner, Hebrew))
361365
}
362366
}
363367

components/calendar/src/cal/hijri.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ impl Hijri<TabularAlgorithm> {
450450
/// Use [`Self::new_tabular`]
451451
#[deprecated(since = "2.1.0", note = "use `Hijri::new_tabular`")]
452452
pub const fn new(leap_years: TabularAlgorithmLeapYears, epoch: TabularAlgorithmEpoch) -> Self {
453-
Self::new_tabular(leap_years, epoch)
453+
Hijri::new_tabular(leap_years, epoch)
454454
}
455455

456456
/// Creates a [`Hijri`] calendar with tabular rules and the given leap year rule and epoch.
@@ -707,8 +707,8 @@ impl<A: AsCalendar<Calendar = Hijri<AstronomicalSimulation>>> Date<A> {
707707
month: u8,
708708
day: u8,
709709
calendar: A,
710-
) -> Result<Self, RangeError> {
711-
Self::try_new_hijri_with_calendar(year, month, day, calendar)
710+
) -> Result<Date<A>, RangeError> {
711+
Date::try_new_hijri_with_calendar(year, month, day, calendar)
712712
}
713713
}
714714

@@ -991,15 +991,15 @@ impl<A: AsCalendar<Calendar = Hijri<R>>, R: Rules> Date<A> {
991991
) -> Result<Self, RangeError> {
992992
ArithmeticDate::from_year_month_day(year, month, day, calendar.as_calendar())
993993
.map(HijriDateInner)
994-
.map(|inner| Self::from_raw(inner, calendar))
994+
.map(|inner| Date::from_raw(inner, calendar))
995995
}
996996
}
997997

998998
impl Date<Hijri<UmmAlQura>> {
999999
/// Deprecated
10001000
#[deprecated(since = "2.1.0", note = "use `Date::try_new_hijri_with_calendar")]
10011001
pub fn try_new_ummalqura(year: i32, month: u8, day: u8) -> Result<Self, RangeError> {
1002-
Self::try_new_hijri_with_calendar(year, month, day, Hijri::new_umm_al_qura())
1002+
Date::try_new_hijri_with_calendar(year, month, day, Hijri::new_umm_al_qura())
10031003
}
10041004
}
10051005

@@ -1011,8 +1011,8 @@ impl<A: AsCalendar<Calendar = Hijri<TabularAlgorithm>>> Date<A> {
10111011
month: u8,
10121012
day: u8,
10131013
calendar: A,
1014-
) -> Result<Self, RangeError> {
1015-
Self::try_new_hijri_with_calendar(year, month, day, calendar)
1014+
) -> Result<Date<A>, RangeError> {
1015+
Date::try_new_hijri_with_calendar(year, month, day, calendar)
10161016
}
10171017
}
10181018

0 commit comments

Comments
 (0)