@@ -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.
@@ -359,7 +359,7 @@ impl Definitions {
359
359
360
360
#[ inline]
361
361
pub fn opt_def_index ( & self , node : ast:: NodeId ) -> Option < DefIndex > {
362
- self . node_to_def_index . get ( & node) . cloned ( )
362
+ self . node_to_def_index . get ( & node) . copied ( )
363
363
}
364
364
365
365
#[ inline]
@@ -413,7 +413,7 @@ impl Definitions {
413
413
#[ inline]
414
414
pub fn opt_span ( & self , def_id : DefId ) -> Option < Span > {
415
415
if def_id. krate == LOCAL_CRATE {
416
- self . def_index_to_span . get ( & def_id. index ) . cloned ( )
416
+ self . def_index_to_span . get ( & def_id. index ) . copied ( )
417
417
} else {
418
418
None
419
419
}
@@ -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
@@ -525,7 +525,7 @@ impl Definitions {
525
525
}
526
526
527
527
pub fn expansion_that_defined ( & self , index : DefIndex ) -> ExpnId {
528
- self . expansions_that_defined . get ( & index) . cloned ( ) . unwrap_or ( ExpnId :: root ( ) )
528
+ self . expansions_that_defined . get ( & index) . copied ( ) . unwrap_or ( ExpnId :: root ( ) )
529
529
}
530
530
531
531
pub fn parent_module_of_macro_def ( & self , expn_id : ExpnId ) -> DefId {
0 commit comments