Skip to content

Deploy #2118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 5, 2025
Merged

Deploy #2118

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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "www-rust-lang-org"
version = "0.1.0"
authors = ["The Rust Project Developers"]
edition = "2018"
edition = "2024"

[dependencies]
handlebars-fluent = "0.4.0"
Expand Down
2 changes: 1 addition & 1 deletion src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use std::future::Future;
use std::sync::Arc;
use std::time::Instant;

use rocket::State;
use rocket::tokio::sync::RwLock;
use rocket::tokio::task;
use rocket::State;

const CACHE_TTL_SECS: u64 = 120;

Expand Down
2 changes: 1 addition & 1 deletion src/caching.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use rocket::fs::NamedFile;
use rocket::http::{hyper, Header};
use rocket::http::{Header, hyper};
use rocket::response::Responder;

#[derive(Responder)]
Expand Down
6 changes: 3 additions & 3 deletions src/i18n.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use serde::Serialize;
use std::{collections::HashSet, sync::LazyLock};

use handlebars_fluent::{
fluent_bundle::{concurrent::FluentBundle, FluentResource, FluentValue},
fluent_bundle::{FluentResource, FluentValue, concurrent::FluentBundle},
loader::SimpleLoader,
simple_loader,
};
Expand All @@ -19,7 +19,7 @@ fn add_bundle_functions(bundle: &mut FluentBundle<&'static FluentResource>) {
bundle
.add_function("EMAIL", |values, _named| {
let email = match values.first() {
Some(FluentValue::String(ref s)) => s,
Some(FluentValue::String(s)) => s,
_ => return FluentValue::None,
};
FluentValue::String(format!("<a href='mailto:{0}' lang='en-US'>{0}</a>", email).into())
Expand All @@ -29,7 +29,7 @@ fn add_bundle_functions(bundle: &mut FluentBundle<&'static FluentResource>) {
bundle
.add_function("ENGLISH", |values, _named| {
let text = match values.first() {
Some(FluentValue::String(ref s)) => s,
Some(FluentValue::String(s)) => s,
_ => return FluentValue::None,
};
FluentValue::String(format!("<span lang='en-US'>{0}</span>", text).into())
Expand Down
10 changes: 5 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ use rocket::tokio::sync::RwLock;
use rust_version::RustReleasePost;
use rust_version::RustVersion;
use serde::Serialize;
use teams::encode_zulip_stream;
use teams::RustTeams;
use teams::encode_zulip_stream;

use std::collections::hash_map::DefaultHasher;
use std::env;
Expand All @@ -30,17 +30,17 @@ use rocket::{
fs::NamedFile,
http::Status,
request::{FromParam, Request},
response::{content, Redirect},
response::{Redirect, content},
};
use rocket_dyn_templates::Template;

use sass_rs::{compile_file, Options};
use sass_rs::{Options, compile_file};

use category::Category;

use caching::CachedNamedFile;
use handlebars_fluent::{loader::Loader, FluentHelper};
use i18n::{create_loader, LocaleInfo, SupportedLocale, TeamHelper, EXPLICIT_LOCALE_INFO};
use handlebars_fluent::{FluentHelper, loader::Loader};
use i18n::{EXPLICIT_LOCALE_INFO, LocaleInfo, SupportedLocale, TeamHelper, create_loader};

const ZULIP_DOMAIN: &str = "https://rust-lang.zulipchat.com";

Expand Down
52 changes: 28 additions & 24 deletions src/teams.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use percent_encoding::{utf8_percent_encode, AsciiSet, NON_ALPHANUMERIC};
use percent_encoding::{AsciiSet, NON_ALPHANUMERIC, utf8_percent_encode};
use rocket_dyn_templates::handlebars::{
Context, Handlebars, Helper, HelperResult, Output, RenderContext, RenderErrorReason,
};
use rust_team_data::v1::{Team, TeamKind, Teams, BASE_URL};
use rust_team_data::v1::{BASE_URL, Team, TeamKind, Teams};
use serde::Serialize;
use std::cmp::Reverse;
use std::collections::HashMap;
Expand Down Expand Up @@ -416,23 +416,26 @@ mod tests {
bar.kind = TeamKind::WorkingGroup;
let data = Data::dummy(vec![foo, bar]);

assert!(data
.clone()
.page_data("teams", "unknown")
.err()
.unwrap()
.is::<TeamNotFound>());
assert!(data
.clone()
.page_data("wgs", "foo")
.err()
.unwrap()
.is::<TeamNotFound>());
assert!(data
.page_data("teams", "bar")
.err()
.unwrap()
.is::<TeamNotFound>());
assert!(
data.clone()
.page_data("teams", "unknown")
.err()
.unwrap()
.is::<TeamNotFound>()
);
assert!(
data.clone()
.page_data("wgs", "foo")
.err()
.unwrap()
.is::<TeamNotFound>()
);
assert!(
data.page_data("teams", "bar")
.err()
.unwrap()
.is::<TeamNotFound>()
);
}

#[test]
Expand All @@ -441,10 +444,11 @@ mod tests {
foo.subteam_of = Some("bar".into());
let data = Data::dummy(vec![foo, dummy_team("bar")]);

assert!(data
.page_data("teams", "foo")
.err()
.unwrap()
.is::<TeamNotFound>());
assert!(
data.page_data("teams", "foo")
.err()
.unwrap()
.is::<TeamNotFound>()
);
}
}
2 changes: 1 addition & 1 deletion tests/well_known_security.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use time::{format_description::well_known::Rfc3339, OffsetDateTime};
use time::{OffsetDateTime, format_description::well_known::Rfc3339};

static TEXT: &str = include_str!("../static/text/well_known_security.txt");

Expand Down