Skip to content

Commit d0bab6a

Browse files
committed
Update lints for 1.64
1 parent f44c540 commit d0bab6a

File tree

7 files changed

+21
-15
lines changed

7 files changed

+21
-15
lines changed

src/instant.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
//! The [`Instant`] struct and its associated `impl`s.
22
3+
use core::borrow::Borrow;
34
use core::cmp::{Ord, Ordering, PartialEq, PartialOrd};
45
use core::ops::{Add, Sub};
56
use core::time::Duration as StdDuration;
6-
use std::borrow::Borrow;
77
use std::time::Instant as StdInstant;
88

99
use crate::Duration;

src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@
9090
#![deny(
9191
anonymous_parameters,
9292
clippy::all,
93+
clippy::alloc_instead_of_core,
94+
clippy::explicit_auto_deref,
95+
clippy::obfuscated_if_else,
96+
clippy::std_instead_of_core,
9397
clippy::undocumented_unsafe_blocks,
9498
const_err,
9599
illegal_floating_point_literal_pattern,

src/parsing/iso8601.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,14 @@ impl<const CONFIG: EncodedConfig> Iso8601<CONFIG> {
5656
Err(err) => err,
5757
};
5858

59-
match dayo(input) {
60-
Some(ParsedItem(input, ordinal)) => {
61-
*parsed = parsed
62-
.with_year(year)
63-
.ok_or(InvalidComponent("year"))?
64-
.with_ordinal(ordinal)
65-
.ok_or(InvalidComponent("ordinal"))?;
66-
return Ok(input);
67-
}
68-
None => {} // The error from year-month-day will always take priority.
59+
// Don't check for `None`, as the error from year-month-day will always take priority.
60+
if let Some(ParsedItem(input, ordinal)) = dayo(input) {
61+
*parsed = parsed
62+
.with_year(year)
63+
.ok_or(InvalidComponent("year"))?
64+
.with_ordinal(ordinal)
65+
.ok_or(InvalidComponent("ordinal"))?;
66+
return Ok(input);
6967
}
7068

7169
match (|| {

src/sys/local_offset_at/imp.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
use crate::{OffsetDateTime, UtcOffset};
44

5+
#[allow(clippy::missing_docs_in_private_items)]
56
pub(super) fn local_offset_at(_datetime: OffsetDateTime) -> Option<UtcOffset> {
67
None
78
}

src/sys/local_offset_at/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! A method to obtain the local offset from UTC.
22
3+
#![allow(clippy::missing_const_for_fn)]
4+
35
#[cfg_attr(target_family = "windows", path = "windows.rs")]
46
#[cfg_attr(target_family = "unix", path = "unix.rs")]
57
#[cfg_attr(

src/sys/local_offset_at/windows.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ use crate::{OffsetDateTime, UtcOffset};
66

77
// ffi: WINAPI FILETIME struct
88
#[repr(C)]
9-
#[allow(non_snake_case)]
9+
#[allow(non_snake_case, clippy::missing_docs_in_private_items)]
1010
struct FileTime {
1111
dwLowDateTime: u32,
1212
dwHighDateTime: u32,
1313
}
1414

1515
// ffi: WINAPI SYSTEMTIME struct
1616
#[repr(C)]
17-
#[allow(non_snake_case)]
17+
#[allow(non_snake_case, clippy::missing_docs_in_private_items)]
1818
struct SystemTime {
1919
wYear: u16,
2020
wMonth: u16,
@@ -33,7 +33,7 @@ extern "system" {
3333

3434
// https://docs.microsoft.com/en-us/windows/win32/api/timezoneapi/nf-timezoneapi-systemtimetotzspecificlocaltime
3535
fn SystemTimeToTzSpecificLocalTime(
36-
lpTimeZoneInformation: *const std::ffi::c_void, // We only pass `nullptr` here
36+
lpTimeZoneInformation: *const core::ffi::c_void, // We only pass `nullptr` here
3737
lpUniversalTime: *const SystemTime,
3838
lpLocalTime: *mut SystemTime,
3939
) -> i32;

src/tests.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#![allow(
22
clippy::let_underscore_drop,
33
clippy::clone_on_copy,
4-
clippy::cognitive_complexity
4+
clippy::cognitive_complexity,
5+
clippy::std_instead_of_core
56
)]
67

78
//! Tests for internal details.

0 commit comments

Comments
 (0)