Update macro and cargo fmt

This commit is contained in:
Steve Cook
2023-03-01 13:43:21 -05:00
parent 51fcc98b34
commit b561bd77c3
19 changed files with 101 additions and 64 deletions

View File

@@ -182,10 +182,18 @@ impl CalendarParsedRXingResult {
};
}
// The when string can be local time, or UTC if it ends with a Z
if when.len() == 16 && when.chars().nth(15).ok_or(Exceptions::INDEX_OUT_OF_BOUNDS)? == 'Z' {
if when.len() == 16
&& when
.chars()
.nth(15)
.ok_or(Exceptions::INDEX_OUT_OF_BOUNDS)?
== 'Z'
{
return match Utc.datetime_from_str(&when, "%Y%m%dT%H%M%SZ") {
Ok(dtm) => Ok(dtm.with_timezone(&Utc).timestamp()),
Err(e) => Err(Exceptions::parse_with(format!("couldn't parse string: {e}"))),
Err(e) => Err(Exceptions::parse_with(format!(
"couldn't parse string: {e}"
))),
};
}
// Try once more, with weird tz formatting
@@ -202,7 +210,9 @@ impl CalendarParsedRXingResult {
};
return match Utc.datetime_from_str(time_part, "%Y%m%dT%H%M%S") {
Ok(dtm) => Ok(dtm.with_timezone(&tz_parsed).timestamp()),
Err(e) => Err(Exceptions::parse_with(format!("couldn't parse string: {e}"))),
Err(e) => Err(Exceptions::parse_with(format!(
"couldn't parse string: {e}"
))),
};
}

View File

@@ -300,7 +300,9 @@ pub fn urlDecode(encoded: &str) -> Result<String> {
if let Ok(decoded) = decode(encoded) {
Ok(decoded.to_string())
} else {
Err(Exceptions::illegal_state_with("UnsupportedEncodingException"))
Err(Exceptions::illegal_state_with(
"UnsupportedEncodingException",
))
}
}