@@ -53,7 +53,7 @@ impl DefPathTable {
53
53
54
54
#[ inline( always) ]
55
55
pub fn def_key ( & self , index : DefIndex ) -> DefKey {
56
- self . index_to_key [ index. index ( ) ] . clone ( )
56
+ self . index_to_key [ index. index ( ) ]
57
57
}
58
58
59
59
#[ inline( always) ]
@@ -111,7 +111,7 @@ pub struct Definitions {
111
111
/// A unique identifier that we can use to lookup a definition
112
112
/// precisely. It combines the index of the definition's parent (if
113
113
/// any) with a `DisambiguatedDefPathData`.
114
- #[ derive( Clone , PartialEq , Debug , RustcEncodable , RustcDecodable ) ]
114
+ #[ derive( Copy , Clone , PartialEq , Debug , RustcEncodable , RustcDecodable ) ]
115
115
pub struct DefKey {
116
116
/// The parent path.
117
117
pub parent : Option < DefIndex > ,
@@ -164,7 +164,7 @@ impl DefKey {
164
164
/// between them. This introduces some artificial ordering dependency
165
165
/// but means that if you have, e.g., two impls for the same type in
166
166
/// the same module, they do get distinct `DefId`s.
167
- #[ derive( Clone , PartialEq , Debug , RustcEncodable , RustcDecodable ) ]
167
+ #[ derive( Copy , Clone , PartialEq , Debug , RustcEncodable , RustcDecodable ) ]
168
168
pub struct DisambiguatedDefPathData {
169
169
pub data : DefPathData ,
170
170
pub disambiguator : u32
@@ -277,7 +277,7 @@ impl DefPath {
277
277
}
278
278
}
279
279
280
- #[ derive( Clone , Debug , PartialEq , Eq , Hash , RustcEncodable , RustcDecodable ) ]
280
+ #[ derive( Copy , Clone , Debug , PartialEq , Eq , Hash , RustcEncodable , RustcDecodable ) ]
281
281
pub enum DefPathData {
282
282
// Root: these should only be used for the root nodes, because
283
283
// they are treated specially by the `def_path` function.
@@ -472,7 +472,7 @@ impl Definitions {
472
472
473
473
// Find the next free disambiguator for this key.
474
474
let disambiguator = {
475
- let next_disamb = self . next_disambiguator . entry ( ( parent, data. clone ( ) ) ) . or_insert ( 0 ) ;
475
+ let next_disamb = self . next_disambiguator . entry ( ( parent, data) ) . or_insert ( 0 ) ;
476
476
let disambiguator = * next_disamb;
477
477
* next_disamb = next_disamb. checked_add ( 1 ) . expect ( "disambiguator overflow" ) ;
478
478
disambiguator
0 commit comments