From c9843d61440edb19642920f2f8f33652e9c83971 Mon Sep 17 00:00:00 2001 From: b-naber Date: Mon, 20 Feb 2023 21:57:03 +0000 Subject: [PATCH] remove cfg attributes --- compiler/rustc_borrowck/src/region_infer/mod.rs | 10 +++++----- compiler/rustc_borrowck/src/renumber.rs | 2 -- .../rustc_infer/src/infer/canonical/query_response.rs | 6 +----- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/compiler/rustc_borrowck/src/region_infer/mod.rs b/compiler/rustc_borrowck/src/region_infer/mod.rs index 0d339dac379ae..b2548b61cc5f9 100644 --- a/compiler/rustc_borrowck/src/region_infer/mod.rs +++ b/compiler/rustc_borrowck/src/region_infer/mod.rs @@ -244,7 +244,6 @@ pub enum ExtraConstraintInfo { PlaceholderFromPredicate(Span), } -#[cfg(debug_assertions)] #[instrument(skip(infcx, sccs), level = "debug")] fn sccs_info<'cx, 'tcx>( infcx: &'cx BorrowckInferCtxt<'cx, 'tcx>, @@ -271,10 +270,10 @@ fn sccs_info<'cx, 'tcx>( components[scc_idx.as_usize()].insert((reg_var, *origin)); } - let mut components_str = "strongly connected components:"; + let mut components_str = "strongly connected components:".to_string(); for (scc_idx, reg_vars_origins) in components.iter().enumerate() { let regions_info = reg_vars_origins.clone().into_iter().collect::>(); - components_str.push(&format( + components_str.push_str(&format!( "{:?}: {:?})", ConstraintSccIndex::from_usize(scc_idx), regions_info, @@ -346,8 +345,9 @@ impl<'tcx> RegionInferenceContext<'tcx> { let fr_static = universal_regions.fr_static; let constraint_sccs = Rc::new(constraints.compute_sccs(&constraint_graph, fr_static)); - #[cfg(debug_assertions)] - sccs_info(_infcx, constraint_sccs.clone()); + if cfg!(debug_assertions) { + sccs_info(_infcx, constraint_sccs.clone()); + } let mut scc_values = RegionValues::new(elements, universal_regions.len(), &placeholder_indices); diff --git a/compiler/rustc_borrowck/src/renumber.rs b/compiler/rustc_borrowck/src/renumber.rs index eb8c86f800ba9..960dedc74efbb 100644 --- a/compiler/rustc_borrowck/src/renumber.rs +++ b/compiler/rustc_borrowck/src/renumber.rs @@ -62,14 +62,12 @@ pub(crate) enum RegionCtxt { LateBound(BoundRegionInfo), Existential(Option), Placeholder(BoundRegionInfo), - #[cfg(debug_assertions)] Unknown, } impl RegionCtxt { /// Used to determine the representative of a component in the strongly connected /// constraint graph - #[cfg(debug_assertions)] pub(crate) fn preference_value(self) -> usize { let _anon = Symbol::intern("anon"); diff --git a/compiler/rustc_infer/src/infer/canonical/query_response.rs b/compiler/rustc_infer/src/infer/canonical/query_response.rs index 1ca9e87e05671..e993fb4c22bb9 100644 --- a/compiler/rustc_infer/src/infer/canonical/query_response.rs +++ b/compiler/rustc_infer/src/infer/canonical/query_response.rs @@ -318,11 +318,7 @@ impl<'tcx> InferCtxt<'tcx> { // Screen out `'a: 'a` cases. let ty::OutlivesPredicate(k1, r2) = r_c.0; - if k1 != r2.into() { - Some(r_c) - } else { - None - } + if k1 != r2.into() { Some(r_c) } else { None } }), );