Skip to content

Commit 541a91e

Browse files
authored
Merge branch 'rust-lang:master' into auto-install-toolchain
2 parents c394d9b + d532482 commit 541a91e

File tree

7 files changed

+16
-18
lines changed

7 files changed

+16
-18
lines changed

build.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ use anyhow::{Context as _, Error, Result};
22
use std::{env, path::Path};
33

44
mod tracked {
5-
use once_cell::sync::Lazy;
65
use std::{
76
collections::HashSet,
87
io::{Error, Result},
98
path::{Path, PathBuf},
10-
sync::Mutex,
9+
sync::{LazyLock, Mutex},
1110
};
1211

13-
static SEEN: Lazy<Mutex<HashSet<PathBuf>>> = Lazy::new(|| Mutex::new(HashSet::new()));
12+
static SEEN: LazyLock<Mutex<HashSet<PathBuf>>> = LazyLock::new(|| Mutex::new(HashSet::new()));
1413

1514
pub(crate) fn track(path: impl AsRef<Path>) -> Result<()> {
1615
let path = path.as_ref();

src/db/mimes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use mime::Mime;
2-
use once_cell::sync::Lazy;
2+
use std::sync::LazyLock;
33

44
macro_rules! mime {
55
($id:ident, $mime:expr) => {
6-
pub(crate) static $id: Lazy<Mime> = Lazy::new(|| $mime.parse().unwrap());
6+
pub(crate) static $id: LazyLock<Mime> = LazyLock::new(|| $mime.parse().unwrap());
77
};
88
}
99

src/repositories/updater.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ use crate::{Config, db::Pool};
55
use async_trait::async_trait;
66
use chrono::{DateTime, Utc};
77
use futures_util::stream::TryStreamExt;
8-
use once_cell::sync::Lazy;
98
use regex::Regex;
109
use std::collections::{HashMap, HashSet};
1110
use std::fmt;
11+
use std::sync::LazyLock;
1212
use tracing::{debug, info, trace, warn};
1313

1414
#[async_trait]
@@ -309,7 +309,7 @@ impl RepositoryStatsUpdater {
309309
}
310310

311311
pub(crate) fn repository_name(url: &str) -> Option<RepositoryName> {
312-
static RE: Lazy<Regex> = Lazy::new(|| {
312+
static RE: LazyLock<Regex> = LazyLock::new(|| {
313313
Regex::new(r"https?://(?P<host>[^/]+)/(?P<owner>[\w\._/-]+)/(?P<repo>[\w\._-]+)").unwrap()
314314
});
315315

src/utils/rustc_version.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use crate::error::Result;
22
use anyhow::{Context, anyhow};
33
use chrono::prelude::*;
4-
use once_cell::sync::Lazy;
54
use regex::Regex;
5+
use std::sync::LazyLock;
66

77
/// Parses rustc commit hash from rustc version string
88
pub fn parse_rustc_version<S: AsRef<str>>(version: S) -> Result<String> {
@@ -22,7 +22,7 @@ pub fn parse_rustc_version<S: AsRef<str>>(version: S) -> Result<String> {
2222
}
2323

2424
pub(crate) fn parse_rustc_date<S: AsRef<str>>(version: S) -> Result<NaiveDate> {
25-
static RE: Lazy<Regex> = Lazy::new(|| Regex::new(r" (\d+)-(\d+)-(\d+)\)$").unwrap());
25+
static RE: LazyLock<Regex> = LazyLock::new(|| Regex::new(r" (\d+)-(\d+)-(\d+)\)$").unwrap());
2626

2727
let cap = RE
2828
.captures(version.as_ref())

src/web/highlight.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::error::Result;
2-
use once_cell::sync::Lazy;
2+
use std::sync::LazyLock;
33
use syntect::{
44
html::{ClassStyle, ClassedHTMLGenerator},
55
parsing::{SyntaxReference, SyntaxSet},
@@ -13,7 +13,7 @@ const PER_LINE_BYTE_LENGTH_LIMIT: usize = 512;
1313
#[error("the code exceeded a highlighting limit")]
1414
pub struct LimitsExceeded;
1515

16-
static SYNTAXES: Lazy<SyntaxSet> = Lazy::new(|| {
16+
static SYNTAXES: LazyLock<SyntaxSet> = LazyLock::new(|| {
1717
static SYNTAX_DATA: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/syntect.packdump"));
1818

1919
let syntaxes: SyntaxSet = syntect::dumps::from_uncompressed_data(SYNTAX_DATA).unwrap();

src/web/rustdoc.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,11 @@ use axum::{
3333
response::{IntoResponse, Response as AxumResponse},
3434
};
3535
use http::{HeaderValue, header};
36-
use once_cell::sync::Lazy;
3736
use semver::Version;
3837
use serde::Deserialize;
3938
use std::{
4039
collections::{BTreeMap, HashMap},
41-
sync::Arc,
40+
sync::{Arc, LazyLock},
4241
};
4342
use tracing::{Instrument, debug, error, info_span, instrument, trace};
4443

@@ -50,8 +49,8 @@ pub(crate) struct OfficialCrateDescription {
5049
pub(crate) description: &'static str,
5150
}
5251

53-
pub(crate) static DOC_RUST_LANG_ORG_REDIRECTS: Lazy<HashMap<&str, OfficialCrateDescription>> =
54-
Lazy::new(|| {
52+
pub(crate) static DOC_RUST_LANG_ORG_REDIRECTS: LazyLock<HashMap<&str, OfficialCrateDescription>> =
53+
LazyLock::new(|| {
5554
HashMap::from([
5655
(
5756
"alloc",
@@ -2535,8 +2534,8 @@ mod test {
25352534
}
25362535
};
25372536

2538-
assert!(status("0.3.0", "2021/01/12").await?);
2539-
assert!(status("0.2.0", "2020/12/01").await?);
2537+
assert!(status("0.3.0", "2021-01-12").await?);
2538+
assert!(status("0.2.0", "2020-12-01").await?);
25402539
Ok(())
25412540
})
25422541
}

templates/macros.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
{%+ endif -%}
150150
<b>{{ release.version }}</b>
151151
{%- if let Some(release_time) = release.release_time -%}
152-
{# +#} ({{ release_time.format("%Y/%m/%d") }})
152+
{# +#} ({{ release_time.format("%Y-%m-%d") }})
153153
{%- endif -%}
154154
</a>
155155
</li>

0 commit comments

Comments
 (0)