clippy: Fix unnecessary_lazy_evaluations warnings (#31898)

This commit is contained in:
Oluwatobi Sofela 2024-03-27 17:16:48 +01:00 committed by GitHub
parent 65db6e3b08
commit 773e881971
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 7 deletions

View file

@ -237,7 +237,7 @@ impl FontHandleMethods for FontHandle {
None => {
let bytes = template.bytes();
let font_file =
FontFile::new_from_data(bytes).ok_or_else(|| "Could not create FontFile")?;
FontFile::new_from_data(bytes).ok_or("Could not create FontFile")?;
let face = font_file
.create_face(0, dwrote::DWRITE_FONT_SIMULATIONS_NONE)
.map_err(|_| "Could not create FontFace")?;

View file

@ -300,11 +300,7 @@ fn parse_hms(s: &str) -> Result<f64, ()> {
let result = match vec.len() {
1 => {
let secs = vec
.pop_front()
.ok_or_else(|| ())?
.parse::<f64>()
.map_err(|_| ())?;
let secs = vec.pop_front().ok_or(())?.parse::<f64>().map_err(|_| ())?;
if secs == 0. {
return Err(());
@ -318,7 +314,7 @@ fn parse_hms(s: &str) -> Result<f64, ()> {
parse_npt_seconds(vec.pop_front().ok_or(())?)?,
),
3 => hms_to_seconds(
vec.pop_front().ok_or_else(|| ())?.parse().map_err(|_| ())?,
vec.pop_front().ok_or(())?.parse().map_err(|_| ())?,
parse_npt_minute(vec.pop_front().ok_or(())?)?,
parse_npt_seconds(vec.pop_front().ok_or(())?)?,
),