Skip to content

Commit 8d3c61b

Browse files
add some explanatory comments
1 parent fe2ee91 commit 8d3c61b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/web/releases.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,9 @@ pub fn search_handler(req: &mut Request) -> IronResult<Response> {
483483
return Ok(resp);
484484
}
485485

486-
486+
// since we never pass a version into `match_version` here, we'll never get
487+
// `MatchVersion::Exact`, so the distinction between `Exact` and `Semver` doesn't
488+
// matter
487489
if let Some(version) = match_version(&conn, &query, None).into_option() {
488490
// FIXME: This is a super dirty way to check if crate have rustdocs generated.
489491
// match_version should handle this instead of this code block.

src/web/rustdoc.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ impl ToJson for RustdocPage {
6666
}
6767

6868

69-
69+
/// Handler called for `/:crate` and `/:crate/:version` URLs. Automatically redirects to the docs
70+
/// or crate details page based on whether the given crate version was successfully built.
7071
pub fn rustdoc_redirector_handler(req: &mut Request) -> IronResult<Response> {
7172

7273
fn redirect_to_doc(req: &Request,
@@ -120,6 +121,8 @@ pub fn rustdoc_redirector_handler(req: &mut Request) -> IronResult<Response> {
120121

121122
let conn = extension!(req, Pool);
122123

124+
// it doesn't matter if the version that was given was exact or not, since we're redirecting
125+
// anyway
123126
let version = match match_version(&conn, &crate_name, req_version).into_option() {
124127
Some(v) => v,
125128
None => return Err(IronError::new(Nope::CrateNotFound, status::NotFound)),

0 commit comments

Comments
 (0)