Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
David Quintanel committed Mar 14, 2022
1 parent 6703056 commit bceb008
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/ntfs/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ where
|v| v != 0,
);

let precision = stop_time.precision.or_else(|| {
let precision = stop_time.precision.or({
if datetime_estimated {
Some(StopTimePrecision::Estimated)
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/ntfs/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ fn build_price_v1(id: &str, ticket: &Ticket, price: &TicketPrice) -> Result<Pric
.round_dp(0)
.to_u32()
.ok_or_else(|| anyhow!("Cannot convert price {:?} into a u32", cents_price))?;
let comment = ticket.comment.clone().unwrap_or_else(String::new);
let comment = ticket.comment.clone().unwrap_or_default();
let price_v1 = PriceV1 {
id: id.to_string(),
start_date: price.ticket_validity_start,
Expand Down
2 changes: 1 addition & 1 deletion src/objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ impl FromStr for Time {
};
let hours: u32 = hours.parse()?;
let minutes: u32 = minutes.parse()?;
let last_second_number = seconds.find('.').unwrap_or_else(|| seconds.len());
let last_second_number = seconds.find('.').unwrap_or(seconds.len());
let seconds: u32 = seconds[..last_second_number].parse()?;
if minutes > 59 || seconds > 59 {
return Err(TimeError::WrongValue);
Expand Down
4 changes: 2 additions & 2 deletions src/serde_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ where
{
use serde::Deserialize;
let option = Option::<String>::deserialize(de)?;
Ok(option.map(|s| s.replace("/", "")))
Ok(option.map(|s| s.replace('/', "")))
}

/// deserialize type
Expand Down Expand Up @@ -267,7 +267,7 @@ where
use serde::ser::Error;
let currency_code = iso4217::alpha3(currency_code)
.ok_or_else(|| S::Error::custom("The String is not a valid currency code (ISO-4217)"))?;
serializer.serialize_str(&currency_code.alpha3.to_string())
serializer.serialize_str(currency_code.alpha3)
}

/// serialize geometry to wkt
Expand Down
2 changes: 1 addition & 1 deletion src/vptranslator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ mod tests {
fn empty_vp() {
let res = translate(&get_dates_from_bitset(
Date::from_ymd(2012, 7, 16),
&"0000000".to_string(),
"0000000",
));

assert_eq!(0b000_0000, get_week_from_weekday(res.operating_days));
Expand Down

0 comments on commit bceb008

Please sign in to comment.