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!
This commit is contained in:
Yuki Okushi 2021-03-04 20:01:12 +09:00 committed by GitHub
commit 06630f7b5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -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)