Skip to content

Commit 06630f7

Browse files
authored
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!
2 parents 17121f2 + c79af86 commit 06630f7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/librustdoc/clean/types.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ impl Item {
191191
}
192192

193193
crate fn links(&self, cache: &Cache) -> Vec<RenderedLink> {
194-
self.attrs.links(&self.def_id.krate, cache)
194+
self.attrs.links(self.def_id.krate, cache)
195195
}
196196

197197
crate fn is_crate(&self) -> bool {
@@ -844,7 +844,7 @@ impl Attributes {
844844
/// Gets links as a vector
845845
///
846846
/// Cache must be populated before call
847-
crate fn links(&self, krate: &CrateNum, cache: &Cache) -> Vec<RenderedLink> {
847+
crate fn links(&self, krate: CrateNum, cache: &Cache) -> Vec<RenderedLink> {
848848
use crate::html::format::href;
849849
use crate::html::render::CURRENT_DEPTH;
850850

@@ -869,7 +869,7 @@ impl Attributes {
869869
}
870870
None => {
871871
if let Some(ref fragment) = *fragment {
872-
let url = match cache.extern_locations.get(krate) {
872+
let url = match cache.extern_locations.get(&krate) {
873873
Some(&(_, _, ExternalLocation::Local)) => {
874874
let depth = CURRENT_DEPTH.with(|l| l.get());
875875
"../".repeat(depth)

0 commit comments

Comments
 (0)