From 9cf59b517867562ebf7413ca2cda762c6b7d6fc0 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 22 Oct 2019 08:22:23 +1100 Subject: [PATCH] Remove some unnecessary renamings of constants. --- src/librustc_incremental/assert_module_sources.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/librustc_incremental/assert_module_sources.rs b/src/librustc_incremental/assert_module_sources.rs index ca035d0cdcb19..6150017f957b2 100644 --- a/src/librustc_incremental/assert_module_sources.rs +++ b/src/librustc_incremental/assert_module_sources.rs @@ -31,10 +31,6 @@ use syntax::symbol::{Symbol, sym}; use rustc::ich::{ATTR_PARTITION_REUSED, ATTR_PARTITION_CODEGENED, ATTR_EXPECTED_CGU_REUSE}; -const MODULE: Symbol = sym::module; -const CFG: Symbol = sym::cfg; -const KIND: Symbol = sym::kind; - pub fn assert_module_sources(tcx: TyCtxt<'_>) { tcx.dep_graph.with_ignore(|| { if tcx.sess.opts.incremental.is_none() { @@ -71,7 +67,7 @@ impl AssertModuleSource<'tcx> { } else if attr.check_name(ATTR_PARTITION_CODEGENED) { (CguReuse::No, ComparisonKind::Exact) } else if attr.check_name(ATTR_EXPECTED_CGU_REUSE) { - match &self.field(attr, KIND).as_str()[..] { + match &self.field(attr, sym::kind).as_str()[..] { "no" => (CguReuse::No, ComparisonKind::Exact), "pre-lto" => (CguReuse::PreLto, ComparisonKind::Exact), "post-lto" => (CguReuse::PostLto, ComparisonKind::Exact), @@ -98,7 +94,7 @@ impl AssertModuleSource<'tcx> { return; } - let user_path = self.field(attr, MODULE).as_str().to_string(); + let user_path = self.field(attr, sym::module).as_str().to_string(); let crate_name = self.tcx.crate_name(LOCAL_CRATE).as_str().to_string(); if !user_path.starts_with(&crate_name) { @@ -125,7 +121,7 @@ impl AssertModuleSource<'tcx> { cgu_path_components, cgu_special_suffix); - debug!("mapping '{}' to cgu name '{}'", self.field(attr, MODULE), cgu_name); + debug!("mapping '{}' to cgu name '{}'", self.field(attr, sym::module), cgu_name); if !self.available_cgus.contains(&cgu_name) { self.tcx.sess.span_err(attr.span, @@ -169,7 +165,7 @@ impl AssertModuleSource<'tcx> { /// cfg flag called `foo`. fn check_config(&self, attr: &ast::Attribute) -> bool { let config = &self.tcx.sess.parse_sess.config; - let value = self.field(attr, CFG); + let value = self.field(attr, sym::cfg); debug!("check_config(config={:?}, value={:?})", config, value); if config.iter().any(|&(name, _)| name == value) { debug!("check_config: matched");