fix clippy #42
6 changed files with 9 additions and 10 deletions
fix clippy for rust 1.64
- newer versions may still lint
commit
d3c5453d47
|
|
@ -2,7 +2,7 @@
|
||||||
name = "better_toml_datetime"
|
name = "better_toml_datetime"
|
||||||
description = "Small helper crate for usage in the jobboerse crate containing some helpers for working with toml date, datetime and time structs"
|
description = "Small helper crate for usage in the jobboerse crate containing some helpers for working with toml date, datetime and time structs"
|
||||||
keywords = ["toml", "date", "time"]
|
keywords = ["toml", "date", "time"]
|
||||||
categories = []
|
categories = ["date-and-time", "encoding"]
|
||||||
version.workspace = true
|
version.workspace = true
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
rust-version.workspace = true
|
rust-version.workspace = true
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ fn main() -> Result<(), std::io::Error> {
|
||||||
println!("cargo:rerun-if-changed=Cargo.lock");
|
println!("cargo:rerun-if-changed=Cargo.lock");
|
||||||
println!("cargo:rerun-if-changed=THIRDPARTY.toml");
|
println!("cargo:rerun-if-changed=THIRDPARTY.toml");
|
||||||
|
|
||||||
let input = BufReader::new(File::open(&thirdparty)?);
|
let input = BufReader::new(File::open(thirdparty)?);
|
||||||
|
|
||||||
#[allow(clippy::expect_fun_call)]
|
#[allow(clippy::expect_fun_call)]
|
||||||
let previous = bundle_licenses_lib::format::Format::Toml
|
let previous = bundle_licenses_lib::format::Format::Toml
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#![warn(clippy::cargo)]
|
#![warn(clippy::cargo)]
|
||||||
#![warn(clippy::unwrap_used)]
|
#![warn(clippy::unwrap_used)]
|
||||||
|
#![allow(clippy::multiple_crate_versions)]
|
||||||
|
|
||||||
// imports from standard library
|
// imports from standard library
|
||||||
use std::net::{Ipv4Addr, Ipv6Addr, SocketAddr};
|
use std::net::{Ipv4Addr, Ipv6Addr, SocketAddr};
|
||||||
|
|
|
||||||
|
|
@ -253,7 +253,7 @@ pub(crate) async fn create_job_offer<'data, 'config>(
|
||||||
.and_then(|highlight| Ok((highlight, req.url_for_static(LOGIN_ROUTE)?)))
|
.and_then(|highlight| Ok((highlight, req.url_for_static(LOGIN_ROUTE)?)))
|
||||||
{
|
{
|
||||||
Ok((highlight_url, login_url)) => {
|
Ok((highlight_url, login_url)) => {
|
||||||
email::send_reviewer_notice(hb, &email_config, highlight_url, login_url).await;
|
email::send_reviewer_notice(hb, email_config, highlight_url, login_url).await;
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
error!("Failed to generate highlight link: {}", err)
|
error!("Failed to generate highlight link: {}", err)
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ pub fn chrono_datetime_to_toml_datetime<Tz: chrono::TimeZone>(
|
||||||
|
|
||||||
pub fn toml_date_to_chrono_date(date: &toml::value::Date) -> chrono::DateTime<FixedOffset> {
|
pub fn toml_date_to_chrono_date(date: &toml::value::Date) -> chrono::DateTime<FixedOffset> {
|
||||||
let local_date =
|
let local_date =
|
||||||
NaiveDate::from_ymd_opt(date.year.into(), date.month.into(), date.day.into()).unwrap();
|
NaiveDate::from_ymd_opt(date.year.into(), date.month.into(), date.day.into()).expect("toml should contain valid date");
|
||||||
let offset = chrono_tz::Europe::Berlin
|
let offset = chrono_tz::Europe::Berlin
|
||||||
.offset_from_local_date(&local_date)
|
.offset_from_local_date(&local_date)
|
||||||
.map(|offset| offset.fix())
|
.map(|offset| offset.fix())
|
||||||
|
|
@ -91,15 +91,13 @@ pub fn toml_datetime_to_chrono_datetime(
|
||||||
toml_date.year.into(),
|
toml_date.year.into(),
|
||||||
toml_date.month.into(),
|
toml_date.month.into(),
|
||||||
toml_date.day.into(),
|
toml_date.day.into(),
|
||||||
)
|
).expect("toml should contain valid date")
|
||||||
.unwrap()
|
|
||||||
.and_hms_nano_opt(
|
.and_hms_nano_opt(
|
||||||
toml_time.hour.into(),
|
toml_time.hour.into(),
|
||||||
toml_time.minute.into(),
|
toml_time.minute.into(),
|
||||||
toml_time.second.into(),
|
toml_time.second.into(),
|
||||||
toml_time.nanosecond,
|
toml_time.nanosecond,
|
||||||
)
|
).expect("toml should contain valid time");
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let offset: FixedOffset = datetime
|
let offset: FixedOffset = datetime
|
||||||
.offset
|
.offset
|
||||||
|
|
@ -108,7 +106,7 @@ pub fn toml_datetime_to_chrono_datetime(
|
||||||
Offset::Z => 0,
|
Offset::Z => 0,
|
||||||
Offset::Custom { minutes } => *minutes as i32 * 60,
|
Offset::Custom { minutes } => *minutes as i32 * 60,
|
||||||
})
|
})
|
||||||
.and_then(|sec_offset| FixedOffset::east_opt(sec_offset))
|
.and_then(FixedOffset::east_opt)
|
||||||
.unwrap_or_else(|| {
|
.unwrap_or_else(|| {
|
||||||
// try to interpret timestamp as local Europe/Berlin time
|
// try to interpret timestamp as local Europe/Berlin time
|
||||||
let tz_result = chrono_tz::Europe::Berlin
|
let tz_result = chrono_tz::Europe::Berlin
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
name = "multipart_helper"
|
name = "multipart_helper"
|
||||||
description = "A helper crate for handling multipart forms in the jobbörse create"
|
description = "A helper crate for handling multipart forms in the jobbörse create"
|
||||||
keywords = ["multipart/form-data"]
|
keywords = ["multipart/form-data"]
|
||||||
categories = []
|
categories = ["encoding", "network-programming"]
|
||||||
version.workspace = true
|
version.workspace = true
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
rust-version.workspace = true
|
rust-version.workspace = true
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue