Skip to content

Commit c3830a0

Browse files
Nemo157Joshua Nelson
authored andcommitted
Attempt to retain current location when loading a different platform
For each target platform, if the current location exists within that platform then generate a link directly to it. Otherwise link to the root of the crate in that platform like normal.
1 parent 5a944b5 commit c3830a0

File tree

4 files changed

+342
-31
lines changed

4 files changed

+342
-31
lines changed

src/test/fakes.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,16 @@ impl<'a> FakeRelease<'a> {
9797
}
9898

9999
pub(crate) fn default_target(mut self, target: &'a str) -> Self {
100+
self = self.add_target(target);
100101
self.default_target = Some(target);
101102
self
102103
}
103104

105+
pub(crate) fn add_target(mut self, target: &str) -> Self {
106+
self.doc_targets.push(target.into());
107+
self
108+
}
109+
104110
pub(crate) fn binary(mut self, bin: bool) -> Self {
105111
self.has_docs = !bin;
106112
if bin {

src/web/crate_details.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub struct CrateDetails {
4242
github_issues: Option<i32>,
4343
pub(crate) metadata: MetaData,
4444
is_library: bool,
45-
doc_targets: Option<Json>,
45+
pub(crate) doc_targets: Option<Json>,
4646
license: Option<String>,
4747
documentation_url: Option<String>,
4848
}

0 commit comments

Comments
 (0)