diff options
| author | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2018-10-16 16:57:53 +0200 |
|---|---|---|
| committer | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2018-10-19 14:34:44 +0200 |
| commit | 3c9258e604c7f5d3b7e86c34da1f067ff0a60257 (patch) | |
| tree | 96a2c373f7f060355817005e3040d07fdbe77262 /src/librustc_codegen_llvm/debuginfo | |
| parent | ee81739dc1e0f1c4dff9480b52528fb688ef9251 (diff) | |
| download | rust-3c9258e604c7f5d3b7e86c34da1f067ff0a60257.tar.gz rust-3c9258e604c7f5d3b7e86c34da1f067ff0a60257.zip | |
Prefer `Default::default` over `FxHash*::default` in struct constructors
Diffstat (limited to 'src/librustc_codegen_llvm/debuginfo')
| -rw-r--r-- | src/librustc_codegen_llvm/debuginfo/metadata.rs | 10 | ||||
| -rw-r--r-- | src/librustc_codegen_llvm/debuginfo/mod.rs | 8 |
2 files changed, 5 insertions, 13 deletions
diff --git a/src/librustc_codegen_llvm/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs index 3c4e000854e..846d5056411 100644 --- a/src/librustc_codegen_llvm/debuginfo/metadata.rs +++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs @@ -96,6 +96,7 @@ pub struct UniqueTypeId(ast::Name); // created so far. The metadata nodes are indexed by UniqueTypeId, and, for // faster lookup, also by Ty. The TypeMap is responsible for creating // UniqueTypeIds. +#[derive(Default)] pub struct TypeMap<'ll, 'tcx> { // The UniqueTypeIds created so far unique_id_interner: Interner, @@ -108,15 +109,6 @@ pub struct TypeMap<'ll, 'tcx> { } impl TypeMap<'ll, 'tcx> { - pub fn new() -> Self { - TypeMap { - unique_id_interner: Interner::new(), - type_to_metadata: FxHashMap::default(), - unique_id_to_metadata: FxHashMap::default(), - type_to_unique_id: FxHashMap::default(), - } - } - // Adds a Ty to metadata mapping to the TypeMap. The method will fail if // the mapping already exists. fn register_type_with_metadata( diff --git a/src/librustc_codegen_llvm/debuginfo/mod.rs b/src/librustc_codegen_llvm/debuginfo/mod.rs index 2cd44b2a6c4..042e72e921e 100644 --- a/src/librustc_codegen_llvm/debuginfo/mod.rs +++ b/src/librustc_codegen_llvm/debuginfo/mod.rs @@ -100,11 +100,11 @@ impl<'a, 'tcx> CrateDebugContext<'a, 'tcx> { llcontext, llmod, builder, - created_files: RefCell::new(FxHashMap::default()), - created_enum_disr_types: RefCell::new(FxHashMap::default()), - type_map: RefCell::new(TypeMap::new()), + created_files: Default::default(), + created_enum_disr_types: Default::default(), + type_map: Default::default(), namespace_map: RefCell::new(DefIdMap()), - composite_types_completed: RefCell::new(FxHashSet::default()), + composite_types_completed: Default::default(), } } } |
