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:
parent
939b14334d
commit
c79af86240
1 changed files with 3 additions and 3 deletions
|
@ -191,7 +191,7 @@ impl Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
crate fn links(&self, cache: &Cache) -> Vec<RenderedLink> {
|
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 {
|
crate fn is_crate(&self) -> bool {
|
||||||
|
@ -844,7 +844,7 @@ impl Attributes {
|
||||||
/// Gets links as a vector
|
/// Gets links as a vector
|
||||||
///
|
///
|
||||||
/// Cache must be populated before call
|
/// 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::format::href;
|
||||||
use crate::html::render::CURRENT_DEPTH;
|
use crate::html::render::CURRENT_DEPTH;
|
||||||
|
|
||||||
|
@ -869,7 +869,7 @@ impl Attributes {
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
if let Some(ref fragment) = *fragment {
|
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)) => {
|
Some(&(_, _, ExternalLocation::Local)) => {
|
||||||
let depth = CURRENT_DEPTH.with(|l| l.get());
|
let depth = CURRENT_DEPTH.with(|l| l.get());
|
||||||
"../".repeat(depth)
|
"../".repeat(depth)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue