Skip to content

Commit 5f86d24

Browse files
authored
Merge branch 'master' into categorize-errors
2 parents 3bf347e + 94264e7 commit 5f86d24

File tree

15 files changed

+1104
-509
lines changed

15 files changed

+1104
-509
lines changed

Cargo.lock

Lines changed: 670 additions & 253 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ docsrs-metadata = { path = "crates/metadata" }
3737
anyhow = { version = "1.0.42", features = ["backtrace"]}
3838
backtrace = "0.3.61"
3939
thiserror = "2.0.3"
40-
comrak = { version = "0.39.0", default-features = false }
40+
comrak = { version = "0.40.0", default-features = false }
4141
syntect = { version = "5.0.0", default-features = false, features = ["parsing", "html", "dump-load", "regex-onig"] }
4242
toml = "0.9.2"
4343
prometheus = { version = "0.14.0", default-features = false }
@@ -108,7 +108,7 @@ constant_time_eq = "0.4.2"
108108
procfs = "0.15.1"
109109

110110
[dev-dependencies]
111-
criterion = "0.6.0"
111+
criterion = "0.7.0"
112112
kuchikiki = "0.8"
113113
http02 = { version = "0.2.11", package = "http"}
114114
http-body-util = "0.1.0"
@@ -128,7 +128,7 @@ debug = "line-tables-only"
128128

129129
[build-dependencies]
130130
time = "0.3"
131-
gix = { version = "0.72.1", default-features = false }
131+
gix = { version = "0.73.0", default-features = false }
132132
string_cache_codegen = "0.5.1"
133133
walkdir = "2"
134134
anyhow = { version = "1.0.42", features = ["backtrace"] }

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();

rust-toolchain.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
[toolchain]
22
channel = "1.88.0"
3+
components = ["rustfmt", "clippy"]

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/storage/mod.rs

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -253,40 +253,6 @@ impl AsyncStorage {
253253
}
254254
}
255255

256-
/// Fetch a rustdoc file from our blob storage.
257-
/// * `name` - the crate name
258-
/// * `version` - the crate version
259-
/// * `latest_build_id` - the id of the most recent build. used purely to invalidate the local archive
260-
/// index cache, when `archive_storage` is `true.` Without it we wouldn't know that we have
261-
/// to invalidate the locally cached file after a rebuild.
262-
/// * `path` - the wanted path inside the documentation.
263-
/// * `archive_storage` - if `true`, we will assume we have a remove ZIP archive and an index
264-
/// where we can fetch the requested path from inside the ZIP file.
265-
#[instrument]
266-
pub(crate) async fn fetch_rustdoc_file(
267-
&self,
268-
name: &str,
269-
version: &str,
270-
latest_build_id: Option<BuildId>,
271-
path: &str,
272-
archive_storage: bool,
273-
) -> Result<Blob> {
274-
trace!("fetch rustdoc file");
275-
Ok(if archive_storage {
276-
self.get_from_archive(
277-
&rustdoc_archive_path(name, version),
278-
latest_build_id,
279-
path,
280-
self.max_file_size_for(path),
281-
)
282-
.await?
283-
} else {
284-
// Add rustdoc prefix, name and version to the path for accessing the file stored in the database
285-
let remote_path = format!("rustdoc/{name}/{version}/{path}");
286-
self.get(&remote_path, self.max_file_size_for(path)).await?
287-
})
288-
}
289-
290256
/// Fetch a rustdoc file from our blob storage.
291257
/// * `name` - the crate name
292258
/// * `version` - the crate version
@@ -840,23 +806,6 @@ impl Storage {
840806
.block_on(self.inner.set_public_access(path, public))
841807
}
842808

843-
pub(crate) fn fetch_rustdoc_file(
844-
&self,
845-
name: &str,
846-
version: &str,
847-
latest_build_id: Option<BuildId>,
848-
path: &str,
849-
archive_storage: bool,
850-
) -> Result<Blob> {
851-
self.runtime.block_on(self.inner.fetch_rustdoc_file(
852-
name,
853-
version,
854-
latest_build_id,
855-
path,
856-
archive_storage,
857-
))
858-
}
859-
860809
pub(crate) fn fetch_source_file(
861810
&self,
862811
name: &str,

src/test/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,9 @@ impl AxumRouterTestExt for axum::Router {
289289
// }
290290

291291
if redirect_target != expected_target {
292-
anyhow::bail!("got redirect to {redirect_target}");
292+
anyhow::bail!(
293+
"got redirect to `{redirect_target}`, expected redirect to `{expected_target}`",
294+
);
293295
}
294296

295297
Ok(response)

0 commit comments

Comments
 (0)