diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2021-03-04 20:01:12 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-04 20:01:12 +0900 |
| commit | 06630f7b5f6eb356e1d36a59d47d63759aec61eb (patch) | |
| tree | ec2035416d62d8c24521fc4fc50bf31e6d70dea8 | |
| parent | 17121f2959ea3735c041c74b5959f9e7c4f84f03 (diff) | |
| parent | c79af862401465a7241e6920ba31f34adafa44fd (diff) | |
| download | rust-06630f7b5f6eb356e1d36a59d47d63759aec61eb.tar.gz rust-06630f7b5f6eb356e1d36a59d47d63759aec61eb.zip | |
Rollup merge of #82744 - camelid:cratenum-byval, r=GuillaumeGomez
Pass `CrateNum` by value instead of by reference It's more idiomatic to pass a small Copy type by value and `CrateNum` is half the size of `&CrateNum` on 64-bit systems. The memory use change is almost certainly insignificant, but why not!
| -rw-r--r-- | src/librustdoc/clean/types.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 09ba0e2740f..e3f47a85d51 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -191,7 +191,7 @@ impl Item { } crate fn links(&self, cache: &Cache) -> Vec<RenderedLink> { - self.attrs.links(&self.def_id.krate, cache) + self.attrs.links(self.def_id.krate, cache) } crate fn is_crate(&self) -> bool { @@ -844,7 +844,7 @@ impl Attributes { /// Gets links as a vector /// /// Cache must be populated before call - crate fn links(&self, krate: &CrateNum, cache: &Cache) -> Vec<RenderedLink> { + crate fn links(&self, krate: CrateNum, cache: &Cache) -> Vec<RenderedLink> { use crate::html::format::href; use crate::html::render::CURRENT_DEPTH; @@ -869,7 +869,7 @@ impl Attributes { } None => { if let Some(ref fragment) = *fragment { - let url = match cache.extern_locations.get(krate) { + let url = match cache.extern_locations.get(&krate) { Some(&(_, _, ExternalLocation::Local)) => { let depth = CURRENT_DEPTH.with(|l| l.get()); "../".repeat(depth) |
