clippy: Fix a bunch of warnings in script (#32680)

This is just a portion of the errors that are remaining to be fixed.
This commit is contained in:
Martin Robinson 2024-07-04 13:40:23 +02:00 committed by GitHub
parent 93fdb8263d
commit 26624a109f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 150 additions and 113 deletions

View file

@ -2141,15 +2141,16 @@ impl HTMLInputElement {
},
InputType::DatetimeLocal => {
// Is this supposed to know the locale's daylight-savings-time rules?
value.parse_local_date_and_time_string().and_then(
|((year, month, day), (hours, minutes, seconds))| {
let hms_millis =
(seconds + 60.0 * minutes as f64 + 3600.0 * hours as f64) * 1000.0;
NaiveDate::from_ymd_opt(year, month, day)
.and_then(|date| date.and_hms_opt(0, 0, 0))
.map(|time| time.and_utc().timestamp_millis() as f64 + hms_millis)
},
)
value.parse_local_date_and_time_string().and_then(|date| {
let seconds = date.seconds as u32;
let milliseconds = ((date.seconds - seconds as f64) * 1000.) as u32;
Some(
NaiveDate::from_ymd_opt(date.year, date.month, date.day)?
.and_hms_milli_opt(date.hour, date.minute, seconds, milliseconds)?
.and_utc()
.timestamp_millis() as f64,
)
})
},
InputType::Number | InputType::Range => value.parse_floating_point_number(),
// min/max/valueAsNumber/stepDown/stepUp do not apply to