fix clippy #42

Merged
ben merged 4 commits from ben/Jobboerse:main into main 2023-01-28 20:40:42 +01:00
6 changed files with 9 additions and 10 deletions
Showing only changes of commit d3c5453d47 - Show all commits

fix clippy for rust 1.64

- newer versions may still lint
Bennet Bleßmann 2023-01-28 19:46:13 +01:00 committed by Bennet Bleßmann
Signed by: ben
GPG key ID: 3BE1A1A3CBC3CF99

View file

@ -2,7 +2,7 @@
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"
keywords = ["toml", "date", "time"]
categories = []
categories = ["date-and-time", "encoding"]
version.workspace = true
edition.workspace = true
rust-version.workspace = true

View file

@ -22,7 +22,7 @@ fn main() -> Result<(), std::io::Error> {
println!("cargo:rerun-if-changed=Cargo.lock");
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)]
let previous = bundle_licenses_lib::format::Format::Toml

View file

@ -1,5 +1,6 @@
#![warn(clippy::cargo)]
#![warn(clippy::unwrap_used)]
#![allow(clippy::multiple_crate_versions)]
// imports from standard library
use std::net::{Ipv4Addr, Ipv6Addr, SocketAddr};

View file

@ -253,7 +253,7 @@ pub(crate) async fn create_job_offer<'data, 'config>(
.and_then(|highlight| Ok((highlight, req.url_for_static(LOGIN_ROUTE)?)))
{
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) => {
error!("Failed to generate highlight link: {}", err)

View file

@ -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> {
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
.offset_from_local_date(&local_date)
.map(|offset| offset.fix())
@ -91,15 +91,13 @@ pub fn toml_datetime_to_chrono_datetime(
toml_date.year.into(),
toml_date.month.into(),
toml_date.day.into(),
)
.unwrap()
).expect("toml should contain valid date")
.and_hms_nano_opt(
toml_time.hour.into(),
toml_time.minute.into(),
toml_time.second.into(),
toml_time.nanosecond,
)
.unwrap();
).expect("toml should contain valid time");
let offset: FixedOffset = datetime
.offset
@ -108,7 +106,7 @@ pub fn toml_datetime_to_chrono_datetime(
Offset::Z => 0,
Offset::Custom { minutes } => *minutes as i32 * 60,
})
.and_then(|sec_offset| FixedOffset::east_opt(sec_offset))
.and_then(FixedOffset::east_opt)
.unwrap_or_else(|| {
// try to interpret timestamp as local Europe/Berlin time
let tz_result = chrono_tz::Europe::Berlin

View file

@ -2,7 +2,7 @@
name = "multipart_helper"
description = "A helper crate for handling multipart forms in the jobbörse create"
keywords = ["multipart/form-data"]
categories = []
categories = ["encoding", "network-programming"]
version.workspace = true
edition.workspace = true
rust-version.workspace = true