Skip to content

Commit 8b388a7

Browse files
committed
Rename assume_exact methods
1 parent 04eb1b3 commit 8b388a7

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

src/web/builds.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub(crate) async fn build_list_handler(
4343
) -> AxumResult<impl IntoResponse> {
4444
let (version, version_or_latest) = match match_version_axum(&pool, &name, Some(&req_version))
4545
.await?
46-
.assume_exact()?
46+
.exact_name_only()?
4747
{
4848
MatchSemver::Exact((version, _)) => (version.clone(), version),
4949
MatchSemver::Latest((version, _)) => (version, "latest".to_string()),
@@ -85,7 +85,7 @@ pub(crate) async fn build_list_json_handler(
8585
) -> AxumResult<impl IntoResponse> {
8686
let version = match match_version_axum(&pool, &name, Some(&req_version))
8787
.await?
88-
.assume_exact()?
88+
.exact_name_only()?
8989
{
9090
MatchSemver::Exact((version, _)) | MatchSemver::Latest((version, _)) => version,
9191
MatchSemver::Semver((version, _)) => {

src/web/crate_details.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ pub(crate) async fn crate_details_handler(
332332
let mut conn = pool.get()?;
333333
Ok(
334334
match_version(&mut conn, &params.name, params.version.as_deref())
335-
.and_then(|m| m.assume_exact())?,
335+
.and_then(|m| m.exact_name_only())?,
336336
)
337337
}
338338
})

src/web/features.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub(crate) async fn build_features_handler(
4242
let (version, version_or_latest, is_latest_url) =
4343
match match_version_axum(&pool, &name, Some(&req_version))
4444
.await?
45-
.assume_exact()?
45+
.exact_name_only()?
4646
{
4747
MatchSemver::Exact((version, _)) => (version.clone(), version, false),
4848
MatchSemver::Latest((version, _)) => (version, "latest".to_string(), true),

src/web/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl MatchVersion {
8484
/// If the matched version was an exact match to the requested crate name, returns the
8585
/// `MatchSemver` for the query. If the lookup required a dash/underscore conversion, returns
8686
/// `CrateNotFound`.
87-
fn assume_exact(self) -> Result<MatchSemver, AxumNope> {
87+
fn exact_name_only(self) -> Result<MatchSemver, AxumNope> {
8888
if self.corrected_name.is_none() {
8989
Ok(self.version)
9090
} else {
@@ -120,7 +120,7 @@ impl MatchSemver {
120120
/// If the matched version was an exact match to a semver version, returns the
121121
/// version string and id for the query. If the lookup required a semver match, returns
122122
/// `VersionNotFound`.
123-
fn assume_exact(self) -> Result<(String, i32), AxumNope> {
123+
fn exact_version_only(self) -> Result<(String, i32), AxumNope> {
124124
let MatchSemver::Exact(details) = self else { return Err(AxumNope::VersionNotFound) };
125125
Ok(details)
126126
}
@@ -605,7 +605,7 @@ mod test {
605605
fn version(v: Option<&str>, db: &TestDatabase) -> Option<String> {
606606
let version = match_version(&mut db.conn(), "foo", v)
607607
.ok()?
608-
.assume_exact()
608+
.exact_name_only()
609609
.ok()?
610610
.into_parts()
611611
.0;

src/web/rustdoc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ pub(crate) async fn download_handler(
874874
) -> AxumResult<impl IntoResponse> {
875875
let (version, _) = match_version_axum(&pool, &name, Some(&req_version))
876876
.await?
877-
.assume_exact()?
877+
.exact_name_only()?
878878
.into_parts();
879879

880880
let archive_path = rustdoc_archive_path(&name, &version);

src/web/status.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ pub(crate) async fn status_handler(
1717
) -> AxumResult<impl IntoResponse> {
1818
let (_, id) = match_version_axum(&pool, &name, Some(&req_version))
1919
.await?
20-
.assume_exact()?
21-
.assume_exact()?;
20+
.exact_name_only()?
21+
.exact_version_only()?;
2222

2323
let rustdoc_status: bool = spawn_blocking({
2424
move || {

0 commit comments

Comments
 (0)