Skip to content

Commit 735e7c6

Browse files
committed
fix comments and doc comments
1 parent e862706 commit 735e7c6

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/web/rustdoc.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,13 +280,21 @@ pub fn rustdoc_html_server_handler(req: &mut Request) -> IronResult<Response> {
280280
.to_resp("rustdoc")
281281
}
282282

283+
/// Checks whether the given path (including version and target information) exists.
284+
/// The crate's `target_name` is used to confirm whether a platform triple is part of the path.
285+
///
286+
/// Returns a path that can be appended to `/crate/version/` to create a complete URL.
283287
fn path_for_version(req_path: &[&str], target_name: &str, conn: &Connection) -> String {
284288
if File::from_path(&conn, &req_path.join("/")).is_some() {
285-
req_path[3..].join("/") // NOTE: this adds 'index.html' if it wasn't there before
286-
} else { // this page doesn't exist in the latest version
287-
let search_item = if *req_path.last().unwrap() == "index.html" { // this is a module
289+
// NOTE: this adds 'index.html' if it wasn't there before
290+
req_path[3..].join("/")
291+
} else {
292+
// this page doesn't exist in the latest version
293+
let search_item = if *req_path.last().unwrap() == "index.html" {
294+
// this is a module
288295
req_path[req_path.len() - 2]
289-
} else { // this is an item
296+
} else {
297+
// this is an item
290298
req_path.last().unwrap().split('.').nth(1)
291299
.expect("paths should be of the form <class>.<name>.html")
292300
};

0 commit comments

Comments
 (0)