diff --git a/src/category.rs b/src/category.rs index 52b7b00c..174ce061 100644 --- a/src/category.rs +++ b/src/category.rs @@ -31,7 +31,7 @@ impl<'r> FromParam<'r> for Category { if is_category(&url) { Ok(Category { name: url }) } else { - Err(format!("No category called <{}>", url)) + Err(format!("No category called <{url}>")) } } } diff --git a/src/i18n.rs b/src/i18n.rs index a2f8b5c2..3b2eb75c 100644 --- a/src/i18n.rs +++ b/src/i18n.rs @@ -22,7 +22,7 @@ fn add_bundle_functions(bundle: &mut FluentBundle<&'static FluentResource>) { Some(FluentValue::String(s)) => s, _ => return FluentValue::None, }; - FluentValue::String(format!("{0}", email).into()) + FluentValue::String(format!("{email}").into()) }) .expect("could not add function"); @@ -32,7 +32,7 @@ fn add_bundle_functions(bundle: &mut FluentBundle<&'static FluentResource>) { Some(FluentValue::String(s)) => s, _ => return FluentValue::None, }; - FluentValue::String(format!("{0}", text).into()) + FluentValue::String(format!("{text}").into()) }) .expect("could not add function"); } diff --git a/src/main.rs b/src/main.rs index eaa8285e..a7d5c270 100644 --- a/src/main.rs +++ b/src/main.rs @@ -125,7 +125,7 @@ fn baseurl(lang: &str) -> String { if lang == "en-US" { String::new() } else { - format!("/{}", lang) + format!("/{lang}") } } @@ -274,13 +274,13 @@ fn hash_css(css: &str) -> String { } fn compile_sass(filename: &str) -> String { - let scss_file = format!("./src/styles/{}.scss", filename); + let scss_file = format!("./src/styles/{filename}.scss"); let css = compile_file(&scss_file, Options::default()) .unwrap_or_else(|_| panic!("couldn't compile sass: {}", &scss_file)); let css_sha = format!("{}_{}", filename, hash_css(&css)); - let css_file = format!("./static/styles/{}.css", css_sha); + let css_file = format!("./static/styles/{css_sha}.css"); fs::write(&css_file, css.into_bytes()) .unwrap_or_else(|_| panic!("couldn't write css file: {}", &css_file)); @@ -291,7 +291,7 @@ fn compile_sass(filename: &str) -> String { fn concat_vendor_css(files: Vec<&str>) -> String { let mut concatted = String::new(); for filestem in files { - let vendor_path = format!("./static/styles/{}.css", filestem); + let vendor_path = format!("./static/styles/{filestem}.css"); let contents = fs::read_to_string(vendor_path).expect("couldn't read vendor css"); concatted.push_str(&contents); } @@ -307,7 +307,7 @@ fn concat_vendor_css(files: Vec<&str>) -> String { fn concat_app_js(files: Vec<&str>) -> String { let mut concatted = String::new(); for filestem in files { - let vendor_path = format!("./static/scripts/{}.js", filestem); + let vendor_path = format!("./static/scripts/{filestem}.js"); let contents = fs::read_to_string(vendor_path).expect("couldn't read app js"); concatted.push_str(&contents); } @@ -354,7 +354,7 @@ async fn render_governance( Ok(Template::render(page, context)) } Err(err) => { - eprintln!("error while loading the governance page: {}", err); + eprintln!("error while loading the governance page: {err}"); Err(Status::InternalServerError) } } @@ -377,7 +377,7 @@ async fn render_team( if err.is::() { Err(Status::NotFound) } else { - eprintln!("error while loading the team page: {}", err); + eprintln!("error while loading the team page: {err}"); Err(Status::InternalServerError) } } @@ -392,7 +392,7 @@ fn render_subject(category: Category, subject: &str, lang: String) -> Result Option { if let Some((_, dest)) = EXTERNAL_REDIRECTS.iter().find(|(src, _)| *src == path) { Some(Redirect::permanent(*dest)) } else if let Some((_, dest)) = PAGE_REDIRECTS.iter().find(|(src, _)| *src == path) { - let dest = format!("/{}", dest); + let dest = format!("/{dest}"); match locale { Locale::Present("en-US") | Locale::NotSpecified => Some(Redirect::permanent(dest)), - Locale::Present(locale) => Some(Redirect::permanent(format!("/{}{}", locale, dest))), + Locale::Present(locale) => Some(Redirect::permanent(format!("/{locale}{dest}"))), Locale::SpecifiedButMissing => Some(Redirect::temporary(dest)), } } else { diff --git a/src/teams.rs b/src/teams.rs index 23a9983f..bc0c65f2 100644 --- a/src/teams.rs +++ b/src/teams.rs @@ -254,7 +254,7 @@ impl Cached for RustTeams { self.1 } async fn fetch() -> Result> { - let resp: Teams = reqwest::get(format!("{}/teams.json", BASE_URL)) + let resp: Teams = reqwest::get(format!("{BASE_URL}/teams.json")) .await? .error_for_status()? .json() @@ -332,8 +332,8 @@ mod tests { ], alumni: Vec::new(), website_data: Some(TeamWebsite { - name: format!("Team {}", name), - description: format!("Description of {}", name), + name: format!("Team {name}"), + description: format!("Description of {name}"), page: name.into(), email: None, repo: None, diff --git a/templates/components/footer.html.hbs b/templates/components/footer.html.hbs index b7b2817b..38f1ac9c 100644 --- a/templates/components/footer.html.hbs +++ b/templates/components/footer.html.hbs @@ -34,13 +34,13 @@

{{fluent "footer-social"}}

{{fluent + alt="{{fluent "mastodon"}}" title="{{fluent "mastodon"}}" /> {{fluent + src="/static/images/bluesky.svg" alt="{{fluent "bluesky"}}" title="{{fluent "bluesky"}}" /> {{fluent + src="/static/images/youtube.svg" alt="{{fluent "footer-alt-youtube"}}" title="YouTube" /> github logo + title="{{fluent "footer-github-alt"}}" />