Skip to content

Commit 1dac23f

Browse files
committed
Use Default more in InferCtxtInner.
1 parent 4df21f2 commit 1dac23f

3 files changed

Lines changed: 7 additions & 18 deletions

File tree

‎compiler/rustc_infer/src/infer/mod.rs‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,12 @@ impl<'tcx> InferCtxtInner<'tcx> {
171171
undo_log:InferCtxtUndoLogs::default(),
172172

173173
projection_cache:Default::default(),
174-
type_variable_storage:type_variable::TypeVariableStorage::new(),
175-
const_unification_storage:ut::UnificationTableStorage::new(),
176-
int_unification_storage:ut::UnificationTableStorage::new(),
177-
float_unification_storage:ut::UnificationTableStorage::new(),
178-
effect_unification_storage:ut::UnificationTableStorage::new(),
179-
region_constraint_storage:Some(RegionConstraintStorage::new()),
174+
type_variable_storage:Default::default(),
175+
const_unification_storage:Default::default(),
176+
int_unification_storage:Default::default(),
177+
float_unification_storage:Default::default(),
178+
effect_unification_storage:Default::default(),
179+
region_constraint_storage:Some(Default::default()),
180180
region_obligations:vec![],
181181
opaque_type_storage:Default::default(),
182182
}

‎compiler/rustc_infer/src/infer/region_constraints/mod.rs‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,6 @@ pub(crate) struct RegionSnapshot {
294294
}
295295

296296
impl<'tcx>RegionConstraintStorage<'tcx>{
297-
pubfnnew() -> Self{
298-
Self::default()
299-
}
300-
301297
#[inline]
302298
pub(crate)fnwith_log<'a>(
303299
&'amutself,

‎compiler/rustc_infer/src/infer/type_variable.rs‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ impl<'tcx> Rollback<sv::UndoLog<ut::Delegate<TyVidEqKey<'tcx>>>> for TypeVariabl
1919
}
2020
}
2121

22-
#[derive(Clone)]
22+
#[derive(Clone,Default)]
2323
pub(crate)structTypeVariableStorage<'tcx>{
2424
/// The origins of each type variable.
2525
values:IndexVec<TyVid,TypeVariableData>,
@@ -74,13 +74,6 @@ impl<'tcx> TypeVariableValue<'tcx> {
7474
}
7575

7676
impl<'tcx>TypeVariableStorage<'tcx>{
77-
pub(crate)fnnew() -> TypeVariableStorage<'tcx>{
78-
TypeVariableStorage{
79-
values:Default::default(),
80-
eq_relations: ut::UnificationTableStorage::new(),
81-
}
82-
}
83-
8477
#[inline]
8578
pub(crate)fnwith_log<'a>(
8679
&'amutself,

0 commit comments

Comments
 (0)