about summary refs log tree commit diff
diff options
context:
space:
mode:
authorb-naber <b_naber@gmx.de>2023-02-20 21:57:03 +0000
committerb-naber <b_naber@gmx.de>2023-02-20 22:00:30 +0000
commitc9843d61440edb19642920f2f8f33652e9c83971 (patch)
tree5b8804dd171209c4fb8b74c9e5307641a1ccb17c
parent0725d0ceee13d3484b2b7117e4cff82c01d8f868 (diff)
downloadrust-c9843d61440edb19642920f2f8f33652e9c83971.tar.gz
rust-c9843d61440edb19642920f2f8f33652e9c83971.zip
remove cfg attributes
-rw-r--r--compiler/rustc_borrowck/src/region_infer/mod.rs10
-rw-r--r--compiler/rustc_borrowck/src/renumber.rs2
-rw-r--r--compiler/rustc_infer/src/infer/canonical/query_response.rs6
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 0d339dac379..b2548b61cc5 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::<Vec<_>>();
-        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 eb8c86f800b..960dedc74ef 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<Symbol>),
     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 1ca9e87e056..e993fb4c22b 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 }
             }),
         );