Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/category.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}>"))
}
}
}
4 changes: 2 additions & 2 deletions src/i18n.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fn add_bundle_functions(bundle: &mut FluentBundle<&'static FluentResource>) {
Some(FluentValue::String(s)) => s,
_ => return FluentValue::None,
};
FluentValue::String(format!("<a href='mailto:{0}' lang='en-US'>{0}</a>", email).into())
FluentValue::String(format!("<a href='mailto:{email}' lang='en-US'>{email}</a>").into())
})
.expect("could not add function");

Expand All @@ -32,7 +32,7 @@ fn add_bundle_functions(bundle: &mut FluentBundle<&'static FluentResource>) {
Some(FluentValue::String(s)) => s,
_ => return FluentValue::None,
};
FluentValue::String(format!("<span lang='en-US'>{0}</span>", text).into())
FluentValue::String(format!("<span lang='en-US'>{text}</span>").into())
})
.expect("could not add function");
}
Expand Down
16 changes: 8 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ fn baseurl(lang: &str) -> String {
if lang == "en-US" {
String::new()
} else {
format!("/{}", lang)
format!("/{lang}")
}
}

Expand Down Expand Up @@ -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));
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand Down Expand Up @@ -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)
}
}
Expand All @@ -377,7 +377,7 @@ async fn render_team(
if err.is::<teams::TeamNotFound>() {
Err(Status::NotFound)
} else {
eprintln!("error while loading the team page: {}", err);
eprintln!("error while loading the team page: {err}");
Err(Status::InternalServerError)
}
}
Expand All @@ -392,7 +392,7 @@ fn render_subject(category: Category, subject: &str, lang: String) -> Result<Tem
// To work around the problem we check whether the template exists beforehand.
let path = Path::new("templates")
.join(category.name())
.join(format!("{}.html.hbs", subject));
.join(format!("{subject}.html.hbs"));
if !path.is_file() {
return Err(Status::NotFound);
}
Expand Down
4 changes: 2 additions & 2 deletions src/redirect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ pub(crate) fn maybe_redirect(path: Path) -> Option<Redirect> {
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 {
Expand Down
6 changes: 3 additions & 3 deletions src/teams.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ impl Cached for RustTeams {
self.1
}
async fn fetch() -> Result<Self, Box<dyn Error + Send + Sync>> {
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()
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions templates/components/footer.html.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@
<h4>{{fluent "footer-social"}}</h4>
<div class="flex flex-row flex-wrap items-center">
<a rel="me" href="https://social.rust-lang.org/@rust" target="_blank"><img src="/static/images/mastodon.svg"
alt="{{fluent " mastodon"}}" title="{{fluent " mastodon"}}" /></a>
alt="{{fluent "mastodon"}}" title="{{fluent "mastodon"}}" /></a>
<a rel="me" href="https://bsky.app/profile/rust-lang.org" target="_blank"><img
src="/static/images/bluesky.svg" alt="{{fluent " bluesky"}}" title="{{fluent " bluesky"}}" /></a>
src="/static/images/bluesky.svg" alt="{{fluent "bluesky"}}" title="{{fluent "bluesky"}}" /></a>
<a href="https://www.youtube.com/channel/UCaYhcUwRBNscFNUKTjgPFiA" target="_blank"><img class="pv2"
src="/static/images/youtube.svg" alt="{{fluent " footer-alt-youtube"}}" title="YouTube" /></a>
src="/static/images/youtube.svg" alt="{{fluent "footer-alt-youtube"}}" title="YouTube" /></a>
<a href="https://github.com/rust-lang" target="_blank"><img src="/static/images/github.svg" alt="github logo"
title="{{fluent " footer-github-alt"}}" /></a>
title="{{fluent "footer-github-alt"}}" /></a>
</div>
</div>

Expand Down