@@ -53,7 +53,7 @@ impl DefPathTable {
5353
5454 #[ inline( always) ]
5555 pub fn def_key ( & self , index : DefIndex ) -> DefKey {
56- self . index_to_key [ index. index ( ) ] . clone ( )
56+ self . index_to_key [ index. index ( ) ]
5757 }
5858
5959 #[ inline( always) ]
@@ -111,7 +111,7 @@ pub struct Definitions {
111111/// A unique identifier that we can use to lookup a definition
112112/// precisely. It combines the index of the definition's parent (if
113113/// any) with a `DisambiguatedDefPathData`.
114- #[ derive( Clone , PartialEq , Debug , RustcEncodable , RustcDecodable ) ]
114+ #[ derive( Copy , Clone , PartialEq , Debug , RustcEncodable , RustcDecodable ) ]
115115pub struct DefKey {
116116 /// The parent path.
117117 pub parent : Option < DefIndex > ,
@@ -164,7 +164,7 @@ impl DefKey {
164164/// between them. This introduces some artificial ordering dependency
165165/// but means that if you have, e.g., two impls for the same type in
166166/// the same module, they do get distinct `DefId`s.
167- #[ derive( Clone , PartialEq , Debug , RustcEncodable , RustcDecodable ) ]
167+ #[ derive( Copy , Clone , PartialEq , Debug , RustcEncodable , RustcDecodable ) ]
168168pub struct DisambiguatedDefPathData {
169169 pub data : DefPathData ,
170170 pub disambiguator : u32
@@ -277,7 +277,7 @@ impl DefPath {
277277 }
278278}
279279
280- #[ derive( Clone , Debug , PartialEq , Eq , Hash , RustcEncodable , RustcDecodable ) ]
280+ #[ derive( Copy , Clone , Debug , PartialEq , Eq , Hash , RustcEncodable , RustcDecodable ) ]
281281pub enum DefPathData {
282282 // Root: these should only be used for the root nodes, because
283283 // they are treated specially by the `def_path` function.
@@ -359,7 +359,7 @@ impl Definitions {
359359
360360 #[ inline]
361361 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 ( )
363363 }
364364
365365 #[ inline]
@@ -413,7 +413,7 @@ impl Definitions {
413413 #[ inline]
414414 pub fn opt_span ( & self , def_id : DefId ) -> Option < Span > {
415415 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 ( )
417417 } else {
418418 None
419419 }
@@ -472,7 +472,7 @@ impl Definitions {
472472
473473 // Find the next free disambiguator for this key.
474474 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 ) ;
476476 let disambiguator = * next_disamb;
477477 * next_disamb = next_disamb. checked_add ( 1 ) . expect ( "disambiguator overflow" ) ;
478478 disambiguator
@@ -525,7 +525,7 @@ impl Definitions {
525525 }
526526
527527 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 ( ) )
529529 }
530530
531531 pub fn parent_module_of_macro_def ( & self , expn_id : ExpnId ) -> DefId {
0 commit comments