explicit_ty_bound code golf

This commit is contained in:
kraktus 2022-10-15 14:57:08 +02:00
parent 36b2685977
commit d38175f271

View file

@ -88,10 +88,9 @@ impl<'a, 'tcx> NumericFallbackVisitor<'a, 'tcx> {
fn check_lit(&self, lit: &Lit, lit_ty: Ty<'tcx>, emit_hir_id: HirId) { fn check_lit(&self, lit: &Lit, lit_ty: Ty<'tcx>, emit_hir_id: HirId) {
if_chain! { if_chain! {
if !in_external_macro(self.cx.sess(), lit.span); if !in_external_macro(self.cx.sess(), lit.span);
if let Some(explicit_ty_bounds) = self.ty_bounds.last(); if matches!(self.ty_bounds.last(), Some(ExplicitTyBound(false)));
if matches!(lit.node, if matches!(lit.node,
LitKind::Int(_, LitIntType::Unsuffixed) | LitKind::Float(_, LitFloatType::Unsuffixed)); LitKind::Int(_, LitIntType::Unsuffixed) | LitKind::Float(_, LitFloatType::Unsuffixed));
if !explicit_ty_bounds.0;
then { then {
let (suffix, is_float) = match lit_ty.kind() { let (suffix, is_float) = match lit_ty.kind() {
ty::Int(IntTy::I32) => ("i32", false), ty::Int(IntTy::I32) => ("i32", false),