Skip to content

Commit 7e4a933

Browse files
authored
Merge pull request #11712 from rust-lang/renovate/rust-1.x
Update Rust to v1.89.0
2 parents 3b78aca + ddacce2 commit 7e4a933

File tree

10 files changed

+76
-82
lines changed

10 files changed

+76
-82
lines changed

backend.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# renovate: datasource=github-tags depName=rust lookupName=rust-lang/rust
2-
ARG RUST_VERSION=1.88.0
2+
ARG RUST_VERSION=1.89.0
33

44
FROM rust:$RUST_VERSION
55

crates/crates_io_database/src/models/krate.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,10 @@ impl Crate {
294294
return Err(InvalidFeature::Empty);
295295
}
296296
let mut chars = name.chars();
297-
if let Some(ch) = chars.next() {
298-
if !(unicode_xid::UnicodeXID::is_xid_start(ch) || ch == '_' || ch.is_ascii_digit()) {
299-
return Err(InvalidFeature::Start(ch, name.into()));
300-
}
297+
if let Some(ch) = chars.next()
298+
&& !(unicode_xid::UnicodeXID::is_xid_start(ch) || ch == '_' || ch.is_ascii_digit())
299+
{
300+
return Err(InvalidFeature::Start(ch, name.into()));
301301
}
302302
for ch in chars {
303303
if !(unicode_xid::UnicodeXID::is_xid_continue(ch)
@@ -320,7 +320,7 @@ impl Crate {
320320
Crate::validate_feature_name(dep_feat)
321321
} else if let Some((_, dep)) = name.split_once("dep:") {
322322
Crate::validate_dependency_name(dep)?;
323-
return Ok(());
323+
Ok(())
324324
} else {
325325
Crate::validate_feature_name(name)
326326
}

crates/crates_io_markdown/lib.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,9 @@ impl UrlRelativeEvaluate<'_> for SanitizeUrl {
243243
new_url.push('/');
244244
}
245245
new_url += url;
246-
if add_sanitize_query {
247-
if let Ok(mut parsed_url) = Url::parse(&new_url) {
248-
parsed_url.query_pairs_mut().append_pair("sanitize", "true");
249-
new_url = parsed_url.into();
250-
}
246+
if add_sanitize_query && let Ok(mut parsed_url) = Url::parse(&new_url) {
247+
parsed_url.query_pairs_mut().append_pair("sanitize", "true");
248+
new_url = parsed_url.into();
251249
}
252250
Cow::Owned(new_url)
253251
})
@@ -303,10 +301,10 @@ pub fn text_to_html<P: AsRef<Path>>(
303301
return markdown_to_html(text, base_url, base_dir);
304302
}
305303

306-
if let Some(ext) = path_in_vcs.extension().and_then(|ext| ext.to_str()) {
307-
if MARKDOWN_EXTENSIONS.contains(&ext.to_lowercase().as_str()) {
308-
return markdown_to_html(text, base_url, base_dir);
309-
}
304+
if let Some(ext) = path_in_vcs.extension().and_then(|ext| ext.to_str())
305+
&& MARKDOWN_EXTENSIONS.contains(&ext.to_lowercase().as_str())
306+
{
307+
return markdown_to_html(text, base_url, base_dir);
310308
}
311309

312310
encode_minimal(text).replace('\n', "<br>\n")

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[toolchain]
2-
channel = "1.88.0"
2+
channel = "1.89.0"

src/controllers/helpers/pagination.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -347,14 +347,13 @@ fn is_useragent_or_ip_blocked(config: &Server, req: &Parts) -> bool {
347347
}
348348

349349
// check if client ip is blocked, needs to be an IPv4 address
350-
if let Some(client_ip) = client_ip {
351-
if config
350+
if let Some(client_ip) = client_ip
351+
&& config
352352
.page_offset_cidr_blocklist
353353
.iter()
354354
.any(|blocked| blocked.contains(**client_ip))
355-
{
356-
return true;
357-
}
355+
{
356+
return true;
358357
}
359358

360359
false

src/controllers/krate/publish.rs

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -601,18 +601,16 @@ pub async fn publish(app: AppState, req: Parts, body: Body) -> AppResult<Json<Go
601601

602602
let pkg_path_in_vcs = tarball_info.vcs_info.map(|info| info.path_in_vcs);
603603

604-
if let Some(readme) = metadata.readme {
605-
if !readme.is_empty() {
606-
jobs::RenderAndUploadReadme::new(
607-
version.id,
608-
readme,
609-
metadata
610-
.readme_file
611-
.unwrap_or_else(|| String::from("README.md")),
612-
repository,
613-
pkg_path_in_vcs,
614-
).enqueue(conn).await?;
615-
}
604+
if let Some(readme) = metadata.readme && !readme.is_empty() {
605+
jobs::RenderAndUploadReadme::new(
606+
version.id,
607+
readme,
608+
metadata
609+
.readme_file
610+
.unwrap_or_else(|| String::from("README.md")),
611+
repository,
612+
pkg_path_in_vcs,
613+
).enqueue(conn).await?;
616614
}
617615

618616
// Upload crate tarball
@@ -912,13 +910,13 @@ pub fn validate_dependency(dep: &EncodableCrateDependency) -> AppResult<()> {
912910
Crate::validate_feature(feature).map_err(bad_request)?;
913911
}
914912

915-
if let Some(registry) = &dep.registry {
916-
if !registry.is_empty() {
917-
return Err(bad_request(format_args!(
918-
"Dependency `{}` is hosted on another registry. Cross-registry dependencies are not permitted on crates.io.",
919-
dep.name
920-
)));
921-
}
913+
if let Some(registry) = &dep.registry
914+
&& !registry.is_empty()
915+
{
916+
return Err(bad_request(format_args!(
917+
"Dependency `{}` is hosted on another registry. Cross-registry dependencies are not permitted on crates.io.",
918+
dep.name
919+
)));
922920
}
923921

924922
match semver::VersionReq::parse(&dep.version_req) {

src/controllers/krate/search.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,7 @@ pub async fn list_crates(
194194
// To avoid breaking existing users, seek-based pagination is only used if an explicit page has
195195
// not been provided. This way clients relying on meta.next_page will use the faster seek-based
196196
// paginations, while client hardcoding pages handling will use the slower offset-based code.
197-
let (total, next_page, prev_page, data) = if !explicit_page && seek.is_some() {
198-
let seek = seek.unwrap();
197+
let (total, next_page, prev_page, data) = if !explicit_page && let Some(seek) = seek {
199198
if let Some(condition) = seek
200199
.after(&pagination.page)?
201200
.map(|s| filter_params.seek_after(&s))

src/controllers/user/update.rs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -61,35 +61,35 @@ pub async fn update_user(
6161
return Err(bad_request("current user does not match requested user"));
6262
}
6363

64-
if let Some(publish_notifications) = &user_update.user.publish_notifications {
65-
if user.publish_notifications != *publish_notifications {
66-
diesel::update(user)
67-
.set(users::publish_notifications.eq(*publish_notifications))
68-
.execute(&mut conn)
69-
.await?;
70-
71-
if !publish_notifications {
72-
let email_address = user.verified_email(&mut conn).await?;
73-
74-
if let Some(email_address) = email_address {
75-
let email = EmailMessage::from_template(
76-
"unsubscribe_notifications",
77-
context! {
78-
user_name => user.gh_login,
79-
domain => state.emails.domain
80-
},
81-
);
82-
83-
match email {
84-
Ok(email) => {
85-
if let Err(error) = state.emails.send(&email_address, email).await {
86-
warn!(
87-
"Failed to send publish notifications unsubscribe email to {email_address}: {error}"
88-
);
89-
}
64+
if let Some(publish_notifications) = &user_update.user.publish_notifications
65+
&& user.publish_notifications != *publish_notifications
66+
{
67+
diesel::update(user)
68+
.set(users::publish_notifications.eq(*publish_notifications))
69+
.execute(&mut conn)
70+
.await?;
71+
72+
if !publish_notifications {
73+
let email_address = user.verified_email(&mut conn).await?;
74+
75+
if let Some(email_address) = email_address {
76+
let email = EmailMessage::from_template(
77+
"unsubscribe_notifications",
78+
context! {
79+
user_name => user.gh_login,
80+
domain => state.emails.domain
81+
},
82+
);
83+
84+
match email {
85+
Ok(email) => {
86+
if let Err(error) = state.emails.send(&email_address, email).await {
87+
warn!(
88+
"Failed to send publish notifications unsubscribe email to {email_address}: {error}"
89+
);
9090
}
91-
Err(error) => warn!("Failed to render unsubscribe email template: {error}"),
9291
}
92+
Err(error) => warn!("Failed to render unsubscribe email template: {error}"),
9393
}
9494
}
9595
}

src/middleware/block_traffic.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ pub fn block_routes(
8686
matched_path: Option<&MatchedPath>,
8787
state: &AppState,
8888
) -> Result<(), BoxedAppError> {
89-
if let Some(matched_path) = matched_path {
90-
if state.config.blocked_routes.contains(matched_path.as_str()) {
91-
let body = "This route is temporarily blocked. See https://status.crates.io.";
92-
return Err(custom(StatusCode::SERVICE_UNAVAILABLE, body));
93-
}
89+
if let Some(matched_path) = matched_path
90+
&& state.config.blocked_routes.contains(matched_path.as_str())
91+
{
92+
let body = "This route is temporarily blocked. See https://status.crates.io.";
93+
return Err(custom(StatusCode::SERVICE_UNAVAILABLE, body));
9494
}
9595

9696
Ok(())

src/worker/jobs/generate_og_image.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,17 @@ impl BackgroundJob for GenerateOgImage {
105105
let og_image_path = format!("og-images/{crate_name}.png");
106106

107107
// Invalidate CloudFront CDN
108-
if let Some(cloudfront) = ctx.cloudfront() {
109-
if let Err(error) = cloudfront.invalidate(&og_image_path).await {
110-
warn!("Failed to invalidate CloudFront CDN for {crate_name}: {error}");
111-
}
108+
if let Some(cloudfront) = ctx.cloudfront()
109+
&& let Err(error) = cloudfront.invalidate(&og_image_path).await
110+
{
111+
warn!("Failed to invalidate CloudFront CDN for {crate_name}: {error}");
112112
}
113113

114114
// Invalidate Fastly CDN
115-
if let Some(fastly) = ctx.fastly() {
116-
if let Err(error) = fastly.invalidate(&og_image_path).await {
117-
warn!("Failed to invalidate Fastly CDN for {crate_name}: {error}");
118-
}
115+
if let Some(fastly) = ctx.fastly()
116+
&& let Err(error) = fastly.invalidate(&og_image_path).await
117+
{
118+
warn!("Failed to invalidate Fastly CDN for {crate_name}: {error}");
119119
}
120120

121121
info!("CDN invalidation completed for crate {crate_name}");

0 commit comments

Comments
 (0)