1
Fork 0

Use chars for constant patterns.

This commit is contained in:
Bauke 2023-01-09 16:22:51 +01:00
parent 78187bbe07
commit c8c9d7c507
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
2 changed files with 2 additions and 2 deletions

View File

@ -30,7 +30,7 @@ fn main() -> Result<()> {
fn build_userstyles(build_dir: &Path) -> Result<()> { fn build_userstyles(build_dir: &Path) -> Result<()> {
for target in userstyles::ALL_USERSTYLES { for target in userstyles::ALL_USERSTYLES {
let style = userstyles::Userstyle::load(target)?; let style = userstyles::Userstyle::load(target)?;
let style_name = style.metadata.name.to_lowercase().replace(" ", "-"); let style_name = style.metadata.name.to_lowercase().replace(' ', "-");
let style_dir = build_dir.join("userstyles"); let style_dir = build_dir.join("userstyles");
fs::create_dir_all(&style_dir)?; fs::create_dir_all(&style_dir)?;

View File

@ -25,7 +25,7 @@ Turn a timestamp with format `mm:ss` into its total seconds.
- `01:30` -> 90 seconds - `01:30` -> 90 seconds
*/ */
pub fn timestamp_to_seconds(timestamp: &str) -> askama::Result<i32> { pub fn timestamp_to_seconds(timestamp: &str) -> askama::Result<i32> {
let mut split = timestamp.split(":"); let mut split = timestamp.split(':');
let minutes = split.next().map(str::parse::<i32>).unwrap().unwrap(); let minutes = split.next().map(str::parse::<i32>).unwrap().unwrap();
let seconds = split.next().map(str::parse::<i32>).unwrap().unwrap(); let seconds = split.next().map(str::parse::<i32>).unwrap().unwrap();
Ok(minutes * 60 + seconds) Ok(minutes * 60 + seconds)