diff options
| author | Deadbeef <ent3rm4n@gmail.com> | 2021-07-04 23:50:34 +0800 |
|---|---|---|
| committer | Deadbeef <ent3rm4n@gmail.com> | 2021-07-10 20:54:47 +0800 |
| commit | 3660a4e97259a23b9a24c30aa097932ae6f0eb18 (patch) | |
| tree | d740a6fdc515c949256ab1798ad06bb0f322b387 /compiler/rustc_passes/src | |
| parent | 2db927d8d82260759e4aaa183dbebd0adbb00177 (diff) | |
| download | rust-3660a4e97259a23b9a24c30aa097932ae6f0eb18.tar.gz rust-3660a4e97259a23b9a24c30aa097932ae6f0eb18.zip | |
Applied suggestions
Diffstat (limited to 'compiler/rustc_passes/src')
| -rw-r--r-- | compiler/rustc_passes/src/check_const.rs | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/compiler/rustc_passes/src/check_const.rs b/compiler/rustc_passes/src/check_const.rs index eaeec19eb31..6ee54cfe37f 100644 --- a/compiler/rustc_passes/src/check_const.rs +++ b/compiler/rustc_passes/src/check_const.rs @@ -93,17 +93,12 @@ impl<'tcx> hir::itemlikevisit::ItemLikeVisitor<'tcx> for CheckConstTraitVisitor< kind: ty::AssocKind::Fn, ident, defaultness, .. } = self.tcx.associated_item(*did) { - match ( - self.tcx.has_attr(*did, sym::default_method_body_is_const), - defaultness.has_value(), - ) { - (false, true) => { - to_implement.insert(ident); - } - // ignore functions that do not have default bodies - // if those are unimplemented it will be catched by - // typeck. - _ => {} + // we can ignore functions that do not have default bodies: + // if those are unimplemented it will be catched by typeck. + if defaultness.has_value() + && !self.tcx.has_attr(*did, sym::default_method_body_is_const) + { + to_implement.insert(ident); } } } |
