Derive Default instead of new in applicable lint

This commit is contained in:
sd234678 2019-04-24 13:47:26 +01:00
parent 112f7e9ac5
commit 64f7cede8b
2 changed files with 2 additions and 7 deletions

View File

@ -542,18 +542,13 @@ declare_lint! {
"detects missing implementations of fmt::Debug"
}
#[derive(Default)]
pub struct MissingDebugImplementations {
impling_types: Option<HirIdSet>,
}
impl_lint_pass!(MissingDebugImplementations => [MISSING_DEBUG_IMPLEMENTATIONS]);
impl MissingDebugImplementations {
pub fn new() -> MissingDebugImplementations {
MissingDebugImplementations { impling_types: None }
}
}
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDebugImplementations {
fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &hir::Item) {
if !cx.access_levels.is_reachable(item.hir_id) {

View File

@ -132,7 +132,7 @@ macro_rules! late_lint_passes {
// Depends on access levels
// FIXME: Turn the computation of types which implement Debug into a query
// and change this to a module lint pass
MissingDebugImplementations: MissingDebugImplementations::new(),
MissingDebugImplementations: MissingDebugImplementations::default(),
]);
)
}