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:
commit
06630f7b5f
1 changed files with 3 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue